Skip to content

Commit 8a30bd5

Browse files
authored
Feature/migrate filament v3 to v4 (#422)
1 parent 9737b8e commit 8a30bd5

File tree

166 files changed

+4401
-4519
lines changed

Some content is hidden

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

166 files changed

+4401
-4519
lines changed

.claude/settings.local.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"enabledMcpjsonServers": [
3+
"laravel-boost"
4+
],
5+
"enableAllProjectMcpServers": true
6+
}

.env.example

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,23 @@ APP_FALLBACK_LOCALE=fr
1010
APP_PORT=8080
1111
APP_SERVICE=laravelcm
1212

13+
BCRYPT_ROUNDS=12
14+
1315
LOG_CHANNEL=stack
1416
LOG_STACK=single,nightwatch
1517
LOG_LEVEL=debug
18+
LOG_SOCKET_URL=buggregator:9913
1619

20+
# Ray Configuration
1721
RAY_HOST=ray@buggregator
1822
RAY_PORT=8000
23+
# Sentry
1924
SENTRY_LARAVEL_DSN=http://sentry@buggregator:8000/1
2025
SENTRY_TRACES_SAMPLE_RATE=1.0
26+
#Var Dumper
2127
VAR_DUMPER_FORMAT=server
2228
VAR_DUMPER_SERVER=tcp://buggregator:9912
29+
# Inspector
2330
INSPECTOR_URL=http://inspector@buggregator:8000
2431
INSPECTOR_API_KEY=test
2532
INSPECTOR_INGESTION_KEY=1test
@@ -34,8 +41,7 @@ DB_PASSWORD=password
3441

3542
BROADCAST_DRIVER=log
3643
MEDIA_DISK=media
37-
FILESYSTEM_DISK=${MEDIA_DISK}
38-
FILAMENT_FILESYSTEM_DISK=${MEDIA_DISK}
44+
FILESYSTEM_DISK="${MEDIA_DISK}"
3945
FILAMENT_PATH=cpanel
4046

4147
QUEUE_CONNECTION=database

.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

.gitignore

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,17 @@
11
/node_modules
22
npm-debug.log
33
yarn-error.log
4-
yarn.lock
54
package-json.lock
6-
pnpm-lock.yml
75
/vendor
86
composer.phar
9-
/.junie
10-
/.claude
117
/.idea
128
/.vscode
139
.phpunit.cache
1410
.phpunit.result.cache
1511
/public/build
1612
/public/hot
1713
/public/storage
14+
/public/fonts
1815
/public/media
1916
/public/css
2017
/public/js

.mcp.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
{
22
"mcpServers": {
33
"laravel-boost": {
4-
"command": "php",
4+
"command": "./vendor/bin/sail",
55
"args": [
6-
"artisan",
7-
"boost:mcp"
6+
"artisan",
7+
"boost:mcp"
88
]
99
}
1010
}

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-
"filament/filament": "^3.2"
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) {

0 commit comments

Comments
 (0)