Skip to content

Commit 141ced7

Browse files
committed
feat: migrate from filament/tailwind 3 to v4
1 parent aded795 commit 141ced7

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+593
-525
lines changed

.env.testing

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,4 +31,3 @@ SENTRY_LARAVEL_DSN=
3131
INSPECTOR_ENABLE=false
3232

3333
BCRYPT_ROUNDS=4
34-
VIEW_COMPILED_PATH=/tmp/views

.mcp.json

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
11
{
22
"mcpServers": {
33
"laravel-boost": {
4-
"command": "php",
5-
"args": [
6-
"artisan",
7-
"boost:mcp"
8-
]
4+
"command": "./vendor/bin/sail",
5+
"args": ["php", "artisan", "boost:mcp"]
96
}
107
}
118
}

CLAUDE.md

Lines changed: 57 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,26 @@ The Laravel Boost guidelines are specifically curated by Laravel maintainers for
88
## Foundational Context
99
This application is a Laravel application and its main Laravel ecosystems package & versions are below. You are an expert with them all. Ensure you abide by these specific packages & versions.
1010

11-
- php - 8.4.12
12-
- filament/filament (FILAMENT) - v3
11+
- php - 8.4.10
12+
- filament/filament (FILAMENT) - v4
1313
- laravel/framework (LARAVEL) - v12
14+
- laravel/nightwatch (NIGHTWATCH) - v1
15+
- laravel/octane (OCTANE) - v2
1416
- laravel/prompts (PROMPTS) - v0
1517
- laravel/socialite (SOCIALITE) - v5
1618
- livewire/livewire (LIVEWIRE) - v3
1719
- livewire/volt (VOLT) - v1
1820
- larastan/larastan (LARASTAN) - v3
1921
- laravel/breeze (BREEZE) - v2
22+
- laravel/mcp (MCP) - v0
2023
- laravel/pint (PINT) - v1
2124
- laravel/sail (SAIL) - v1
2225
- pestphp/pest (PEST) - v3
2326
- phpunit/phpunit (PHPUNIT) - v11
2427
- rector/rector (RECTOR) - v2
2528
- alpinejs (ALPINEJS) - v3
2629
- prettier (PRETTIER) - v3
27-
- tailwindcss (TAILWINDCSS) - v3
30+
- tailwindcss (TAILWINDCSS) - v4
2831

2932

3033
## Conventions
@@ -201,19 +204,25 @@ Forms\Components\Select::make('user_id')
201204
</code-snippet>
202205

203206

204-
=== filament/v3 rules ===
207+
=== filament/v4 rules ===
205208

206-
## Filament 3
209+
## Filament 4
207210

208-
## Version 3 Changes To Focus On
209-
- Resources are located in `app/Filament/Resources/` directory.
210-
- Resource pages (List, Create, Edit) are auto-generated within the resource's directory - e.g., `app/Filament/Resources/PostResource/Pages/`.
211-
- Forms use the `Forms\Components` namespace for form fields.
212-
- Tables use the `Tables\Columns` namespace for table columns.
213-
- A new `Filament\Forms\Components\RichEditor` component is available.
214-
- Form and table schemas now use fluent method chaining.
215-
- Added `php artisan filament:optimize` command for production optimization.
216-
- Requires implementing `FilamentUser` contract for production access control.
211+
### Important Version 4 Changes
212+
- File visibility is now `private` by default.
213+
- The `deferFilters` method from Filament v3 is now the default behavior in Filament v4, so users must click a button before the filters are applied to the table. To disable this behavior, you can use the `deferFilters(false)` method.
214+
- The `Grid`, `Section`, and `Fieldset` layout components no longer span all columns by default.
215+
- The `all` pagination page method is not available for tables by default.
216+
- All action classes extend `Filament\Actions\Action`. No action classes exist in `Filament\Tables\Actions`.
217+
- The `Form` & `Infolist` layout components have been moved to `Filament\Schemas\Components`, for example `Grid`, `Section`, `Fieldset`, `Tabs`, `Wizard`, etc.
218+
- A new `Repeater` component for Forms has been added.
219+
- Icons now use the `Filament\Support\Icons\Heroicon` Enum by default. Other options are available and documented.
220+
221+
### Organize Component Classes Structure
222+
- Schema components: `Schemas/Components/`
223+
- Table columns: `Tables/Columns/`
224+
- Table filters: `Tables/Filters/`
225+
- Actions: `Actions/`
217226

218227

219228
=== laravel/core rules ===
@@ -288,7 +297,7 @@ Forms\Components\Select::make('user_id')
288297

289298
## Livewire Core
290299
- Use the `search-docs` tool to find exact version specific documentation for how to write Livewire & Livewire tests.
291-
- Use the `php artisan make:livewire [Posts\\CreatePost]` artisan command to create new components
300+
- Use the `php artisan make:livewire [Posts\CreatePost]` artisan command to create new components
292301
- State should live on the server, with the UI reflecting it.
293302
- All Livewire requests hit the Laravel backend, they're like regular HTTP requests. Always validate form data, and run authorization checks in Livewire actions.
294303

@@ -305,7 +314,7 @@ Forms\Components\Select::make('user_id')
305314
@endforeach
306315
```
307316
308-
- Prefer lifecycle hooks like `mount()`, `updatedFoo()`) for initialization and reactive side effects:
317+
- Prefer lifecycle hooks like `mount()`, `updatedFoo()` for initialization and reactive side effects:
309318
310319
<code-snippet name="Lifecycle hook examples" lang="php">
311320
public function mount(User $user) { $this->user = $user; }
@@ -564,11 +573,39 @@ it('has emails', function (string $email) {
564573
- If existing pages and components support dark mode, new pages and components must support dark mode in a similar way, typically using `dark:`.
565574
566575
567-
=== tailwindcss/v3 rules ===
576+
=== tailwindcss/v4 rules ===
577+
578+
## Tailwind 4
579+
580+
- Always use Tailwind CSS v4 - do not use the deprecated utilities.
581+
- `corePlugins` is not supported in Tailwind v4.
582+
- In Tailwind v4, you import Tailwind using a regular CSS `@import` statement, not using the `@tailwind` directives used in v3:
583+
584+
<code-snippet name="Tailwind v4 Import Tailwind Diff" lang="diff">
585+
- @tailwind base;
586+
- @tailwind components;
587+
- @tailwind utilities;
588+
+ @import "tailwindcss";
589+
</code-snippet>
590+
568591
569-
## Tailwind 3
592+
### Replaced Utilities
593+
- Tailwind v4 removed deprecated utilities. Do not use the deprecated option - use the replacement.
594+
- Opacity values are still numeric.
570595
571-
- Always use Tailwind CSS v3 - verify you're using only classes supported by this version.
596+
| Deprecated | Replacement |
597+
|------------+--------------|
598+
| bg-opacity-* | bg-black/* |
599+
| text-opacity-* | text-black/* |
600+
| border-opacity-* | border-black/* |
601+
| divide-opacity-* | divide-black/* |
602+
| ring-opacity-* | ring-black/* |
603+
| placeholder-opacity-* | placeholder-black/* |
604+
| flex-shrink-* | shrink-* |
605+
| flex-grow-* | grow-* |
606+
| overflow-ellipsis | text-ellipsis |
607+
| decoration-slice | box-decoration-slice |
608+
| decoration-clone | box-decoration-clone |
572609
573610
574611
=== tests rules ===
@@ -577,4 +614,4 @@ it('has emails', function (string $email) {
577614
578615
- Every change must be programmatically tested. Write a new test or update an existing test, then run the affected tests to make sure they pass.
579616
- Run the minimum number of tests needed to ensure code quality and speed. Use `php artisan test` with a specific filename or filter.
580-
</laravel-boost-guidelines>
617+
</laravel-boost-guidelines>

app-modules/gamify/composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
"version": "1.1.0",
66
"license": "proprietary",
77
"require": {
8-
"php": "^8.3"
8+
"php": "^8.4"
99
},
1010
"require-dev": {
11-
"pestphp/pest": "^2.32",
12-
"pestphp/pest-plugin-laravel": "^2.1"
11+
"pestphp/pest": "^3.8",
12+
"pestphp/pest-plugin-laravel": "^3.0"
1313
},
1414
"autoload": {
1515
"psr-4": {

app-modules/gamify/src/Models/Reputation.php

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
/**
1313
* @property-read int $id
14-
* @property int $point
14+
* @property-read int $point
1515
* @property-read User|null $payee
1616
* @property-read \Illuminate\Support\Carbon $created_at
1717
* @property-read \Illuminate\Support\Carbon $updated_at
@@ -28,19 +28,11 @@ public function payee(): BelongsTo
2828
return $this->belongsTo(config('gamify.payee_model'), 'payee_id'); // @phpstan-ignore-line
2929
}
3030

31-
/**
32-
* Get the owning subject model
33-
*/
3431
public function subject(): MorphTo
3532
{
3633
return $this->morphTo();
3734
}
3835

39-
/**
40-
* Undo last point
41-
*
42-
* @throws \Exception
43-
*/
4436
public function undo(): void
4537
{
4638
if ($this->exists) {

app/Livewire/Components/Slideovers/ArticleForm.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Filament\Forms\Components;
1717
use Filament\Forms\Concerns\InteractsWithForms;
1818
use Filament\Forms\Contracts\HasForms;
19+
use Filament\Infolists\Components\TextEntry;
1920
use Filament\Notifications\Notification;
2021
use Filament\Schemas\Components\Grid;
2122
use Filament\Schemas\Components\Group;
@@ -145,8 +146,9 @@ public function form(Schema $schema): Schema
145146
->minLength(10)
146147
->maxHeight('20.25rem')
147148
->required(),
148-
Components\Placeholder::make('')
149-
->content(fn (): HtmlString => new HtmlString(Blade::render(<<<'Blade'
149+
TextEntry::make('placeholder')
150+
->hiddenLabel()
151+
->state(fn (): HtmlString => new HtmlString(Blade::render(<<<'Blade'
150152
<x-torchlight />
151153
Blade))),
152154
])

app/Livewire/Components/Slideovers/DiscussionForm.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Filament\Forms\Components;
1414
use Filament\Forms\Concerns\InteractsWithForms;
1515
use Filament\Forms\Contracts\HasForms;
16+
use Filament\Infolists\Components\TextEntry;
1617
use Filament\Notifications\Notification;
1718
use Filament\Schemas\Components\Utilities\Set;
1819
use Filament\Schemas\Schema;
@@ -92,8 +93,9 @@ public function form(Schema $schema): Schema
9293
->maxHeight('18.25rem')
9394
->required()
9495
->minLength(20),
95-
Components\Placeholder::make('')
96-
->content(fn (): HtmlString => new HtmlString(Blade::render(<<<'Blade'
96+
TextEntry::make('placeholder')
97+
->hiddenLabel()
98+
->state(fn (): HtmlString => new HtmlString(Blade::render(<<<'Blade'
9799
<x-torchlight />
98100
Blade))),
99101
])

app/Livewire/Components/Slideovers/ThreadForm.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414
use Filament\Forms\Components;
1515
use Filament\Forms\Concerns\InteractsWithForms;
1616
use Filament\Forms\Contracts\HasForms;
17+
use Filament\Infolists\Components\TextEntry;
1718
use Filament\Notifications\Notification;
1819
use Filament\Schemas\Components\Utilities\Set;
1920
use Filament\Schemas\Schema;
@@ -102,8 +103,9 @@ public function form(Schema $schema): Schema
102103
->label(__('validation.attributes.content'))
103104
->required()
104105
->minLength(20),
105-
Components\Placeholder::make('')
106-
->content(fn (): HtmlString => new HtmlString(Blade::render(<<<'Blade'
106+
TextEntry::make('placeholder')
107+
->hiddenLabel()
108+
->state(fn (): HtmlString => new HtmlString(Blade::render(<<<'Blade'
107109
<x-torchlight />
108110
Blade))),
109111
])

app/Models/Thread.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
use Carbon\Carbon;
2222
use CyrildeWit\EloquentViewable\Contracts\Viewable;
2323
use CyrildeWit\EloquentViewable\InteractsWithViews;
24+
use Database\Factories\ThreadFactory;
2425
use Exception;
2526
use Illuminate\Database\Eloquent\Attributes\Scope;
2627
use Illuminate\Database\Eloquent\Builder;
@@ -59,6 +60,8 @@
5960
final class Thread extends Model implements Feedable, ReactableInterface, ReplyInterface, SpamReportableContract, SubscribeInterface, Viewable
6061
{
6162
use HasAuthor;
63+
64+
/** @use HasFactory<ThreadFactory> */
6265
use HasFactory;
6366
use HasLocaleScope;
6467
use HasReplies;
@@ -70,7 +73,7 @@ final class Thread extends Model implements Feedable, ReactableInterface, ReplyI
7073
use Reactable;
7174
use RecordsActivity;
7275

73-
public const FEED_PAGE_SIZE = 20;
76+
public const int FEED_PAGE_SIZE = 20;
7477

7578
protected $guarded = [];
7679

app/Traits/RecordsActivity.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ protected function recordActivity(string $event, bool $useDefaultEvent = true, a
5050

5151
protected function getActivityType(string $event): string
5252
{
53-
$type = mb_strtolower((new ReflectionClass($this))->getShortName());
53+
$type = mb_strtolower(new ReflectionClass($this)->getShortName());
5454

5555
return "{$event}_{$type}";
5656
}

0 commit comments

Comments
 (0)