From aa1cd801c66ce6d2efd41267c7732165b6d6ebe2 Mon Sep 17 00:00:00 2001 From: Bram Raaijmakers Date: Tue, 12 Aug 2025 15:54:24 +0200 Subject: [PATCH 1/5] Add support for Filament 4 --- .github/workflows/phpstan.yml | 18 +----- .github/workflows/run-test.yml | 13 +---- README.md | 27 --------- composer.json | 8 +-- phpstan.laravel-10.neon | 17 ------ .../components/developer-logins.blade.php | 55 +++++++------------ src/FilamentDeveloperLoginsPlugin.php | 2 +- 7 files changed, 30 insertions(+), 110 deletions(-) delete mode 100644 phpstan.laravel-10.neon diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml index 74429a4..b5564cc 100644 --- a/.github/workflows/phpstan.yml +++ b/.github/workflows/phpstan.yml @@ -18,26 +18,14 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - php: [8.4, 8.3, 8.2, 8.1] - laravel: [10.*, 11.*, 12.*] + php: [8.4, 8.3, 8.2] + laravel: [11.*, 12.*] stability: [prefer-stable] include: - - laravel: 10.* - testbench: 8.* - phpstan_neon: phpstan.laravel-10.neon - laravel: 11.* testbench: 9.* - phpstan_neon: phpstan.neon - laravel: 12.* testbench: 10.* - phpstan_neon: phpstan.neon - exclude: - - laravel: 10.* - php: 8.4 - - laravel: 11.* - php: 8.1 - - laravel: 12.* - php: 8.1 name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.os }} @@ -60,4 +48,4 @@ jobs: run: composer show -D - name: Run PHPStan - run: vendor/bin/phpstan --error-format=github --configuration=${{ matrix.phpstan_neon }} + run: vendor/bin/phpstan --error-format=github diff --git a/.github/workflows/run-test.yml b/.github/workflows/run-test.yml index 42b5f19..4cdc4d5 100644 --- a/.github/workflows/run-test.yml +++ b/.github/workflows/run-test.yml @@ -20,23 +20,14 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest] - php: [8.4, 8.3, 8.2, 8.1] - laravel: [10.*, 11.*, 12.*] + php: [8.4, 8.3, 8.2] + laravel: [11.*, 12.*] stability: [prefer-stable] include: - - laravel: 10.* - testbench: 8.* - laravel: 11.* testbench: 9.* - laravel: 12.* testbench: 10.* - exclude: - - laravel: 10.* - php: 8.4 - - laravel: 11.* - php: 8.1 - - laravel: 12.* - php: 8.1 name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.os }} diff --git a/README.md b/README.md index e95f2f5..4d2e6f8 100644 --- a/README.md +++ b/README.md @@ -61,33 +61,6 @@ FilamentDeveloperLoginsPlugin::make() ->enabled(app()->environment('local')) ``` -### columns() - -To customize the grid layout, you can use the columns() method. This method allows you to configure the grid layout based on your needs. - -By default, the columns() method sets the grid to 2 columns. You can adjust the default column count or specify different column counts for different screen sizes by passing an array. - -Example: - -```php -// ... -FilamentDeveloperLoginsPlugin::make() - ->columns() // default 2 -``` - -or you can use an array like this - -```php -// ... -FilamentDeveloperLoginsPlugin::make() - ->columns([ - 'sm' => 3, - 'xl' => 6, - '2xl' => 8, - ]) -``` - - ### switchable() By default, a "Switch to" button is shown in the top right corner of the screen, so you can easily switch between the provided users. diff --git a/composer.json b/composer.json index cc0a74b..3508371 100644 --- a/composer.json +++ b/composer.json @@ -21,15 +21,15 @@ } ], "require": { - "php": "^8.1", - "filament/filament": "^3.0", + "php": "^8.2", + "filament/filament": "^4.0", "spatie/laravel-package-tools": "^1.15.0" }, "require-dev": { "friendsofphp/php-cs-fixer": "^3.8", "larastan/larastan": "^2.9|^3.0", "nunomaduro/collision": "^7.0|^8.1", - "orchestra/testbench": "^8.0|^9.0|^10.0", + "orchestra/testbench": "^9.0|^10.0", "phpunit/phpunit": "^10.0|^11.0", "spatie/laravel-ray": "^1.26" }, @@ -63,6 +63,6 @@ ] } }, - "minimum-stability": "dev", + "minimum-stability": "stable", "prefer-stable": true } diff --git a/phpstan.laravel-10.neon b/phpstan.laravel-10.neon deleted file mode 100644 index 59c3197..0000000 --- a/phpstan.laravel-10.neon +++ /dev/null @@ -1,17 +0,0 @@ -includes: - - ./vendor/larastan/larastan/extension.neon - - phpstan-baseline.neon - -parameters: - level: 7 - - paths: - - database - - src - - tests - - ignoreErrors: - - - message: "#^PHPDoc tag @use contains generic type Illuminate\\\\Database\\\\Eloquent\\\\Factories\\\\HasFactory\\ but trait Illuminate\\\\Database\\\\Eloquent\\\\Factories\\\\HasFactory is not generic\\.$#" - count: 1 - path: tests/Fixtures/TestUser.php diff --git a/resources/views/components/developer-logins.blade.php b/resources/views/components/developer-logins.blade.php index 5b12318..5675a8b 100644 --- a/resources/views/components/developer-logins.blade.php +++ b/resources/views/components/developer-logins.blade.php @@ -1,43 +1,28 @@ @if(count($users) > 0) -
- -
-
-

- {{ __('filament-developer-logins::auth.login-as') }} -

-
-
+
+

+ {{ __('filament-developer-logins::auth.login-as') }} +

@if ($errors->has('developer-logins-failed')) -
-

- {{ $errors->first('developer-logins-failed') }} -

-
+

+ {{ $errors->first('developer-logins-failed') }} +

@endif +
- - @foreach ($users as $label => $credentials) -
- @csrf + @foreach ($users as $label => $credentials) + +
+ @csrf - - + + - - {{ "$label ($credentials)" }} - - - @endforeach - -
+ + {{ "$label ($credentials)" }} + +
+ + @endforeach @endif \ No newline at end of file diff --git a/src/FilamentDeveloperLoginsPlugin.php b/src/FilamentDeveloperLoginsPlugin.php index 514242e..6eed0d1 100644 --- a/src/FilamentDeveloperLoginsPlugin.php +++ b/src/FilamentDeveloperLoginsPlugin.php @@ -7,7 +7,7 @@ use DutchCodingCompany\FilamentDeveloperLogins\Exceptions\ImplementationException; use Filament\Contracts\Plugin; use Filament\Facades\Filament; -use Filament\Forms\Concerns\HasColumns; +use Filament\Schemas\Concerns\HasColumns; use Filament\Panel; use Filament\Support\Concerns\EvaluatesClosures; From 7d4fbb582a41f5ced401cb5cf1f1a876c0baaf1e Mon Sep 17 00:00:00 2001 From: Bram Raaijmakers Date: Tue, 12 Aug 2025 16:03:52 +0200 Subject: [PATCH 2/5] Update readme and add upgrading guide --- README.md | 7 +++++++ UPGRADING.md | 9 +++++++++ 2 files changed, 16 insertions(+) create mode 100644 UPGRADING.md diff --git a/README.md b/README.md index 4d2e6f8..ab2c720 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,13 @@ This plugin allows you to enable one-click logins for your local Filament panels ## Installation +| Filament version | Package version | Readme | +|---------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|--------------------------------------------------------------------------------------| +| [^4.x](https://github.com/filamentphp/filament/tree/4.x) | 2.x.x | [Link](https://github.com/DutchCodingCompany/filament-developer-logins/blob/main/README.md) | +| [^3.x](https://github.com/filamentphp/filament/tree/3.x) | 1.x.x | [Link](https://github.com/DutchCodingCompany/filament-developer-logins/blob/1.10.0/README.md) | + + + You can install the package via composer. ```bash diff --git a/UPGRADING.md b/UPGRADING.md new file mode 100644 index 0000000..e6646a5 --- /dev/null +++ b/UPGRADING.md @@ -0,0 +1,9 @@ +# Upgrading + +## Upgrading from 1.x to 2.x + +Version 2.x supports filament 4.x and is not compatible with filament 3.x. Below are the breaking changes: + +- The [columns](https://github.com/DutchCodingCompany/filament-developer-logins/tree/1.10.0?tab=readme-ov-file#columns) feature has been removed. If you were using it you need to remove it from the plugin configuration. + +That's it! If you find any bugs please let me know. \ No newline at end of file From f0c305c3beba2031559608e33c30ebea2cd18db2 Mon Sep 17 00:00:00 2001 From: Bram Raaijmakers Date: Tue, 12 Aug 2025 16:04:38 +0200 Subject: [PATCH 3/5] Fix CS --- src/FilamentDeveloperLoginsPlugin.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/FilamentDeveloperLoginsPlugin.php b/src/FilamentDeveloperLoginsPlugin.php index 6eed0d1..272c760 100644 --- a/src/FilamentDeveloperLoginsPlugin.php +++ b/src/FilamentDeveloperLoginsPlugin.php @@ -7,8 +7,8 @@ use DutchCodingCompany\FilamentDeveloperLogins\Exceptions\ImplementationException; use Filament\Contracts\Plugin; use Filament\Facades\Filament; -use Filament\Schemas\Concerns\HasColumns; use Filament\Panel; +use Filament\Schemas\Concerns\HasColumns; use Filament\Support\Concerns\EvaluatesClosures; class FilamentDeveloperLoginsPlugin implements Plugin From 89a53684daeeb70a526710db87addb2349fb1da4 Mon Sep 17 00:00:00 2001 From: Bram Raaijmakers Date: Tue, 12 Aug 2025 16:17:07 +0200 Subject: [PATCH 4/5] Register panel --- tests/TestCase.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/TestCase.php b/tests/TestCase.php index c4f3004..5958d76 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -29,6 +29,8 @@ protected function setUp(): void { parent::setUp(); + Filament::setCurrentPanel($this->panelName); + Factory::guessFactoryNamesUsing( fn ( string $modelName, From 0f857b6f9884f55c0e583da214ffc812eb80d563 Mon Sep 17 00:00:00 2001 From: Bram Raaijmakers Date: Tue, 26 Aug 2025 10:53:58 +0200 Subject: [PATCH 5/5] Fix tests --- tests/TestCase.php | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/tests/TestCase.php b/tests/TestCase.php index 5958d76..9896a14 100644 --- a/tests/TestCase.php +++ b/tests/TestCase.php @@ -2,6 +2,8 @@ namespace DutchCodingCompany\FilamentDeveloperLogins\Tests; +use BladeUI\Heroicons\BladeHeroiconsServiceProvider; +use BladeUI\Icons\BladeIconsServiceProvider; use DutchCodingCompany\FilamentDeveloperLogins\FilamentDeveloperLoginsPlugin; use DutchCodingCompany\FilamentDeveloperLogins\FilamentDeveloperLoginsServiceProvider; use DutchCodingCompany\FilamentDeveloperLogins\Http\Controllers\DeveloperLoginsController; @@ -13,6 +15,7 @@ use Filament\Notifications\NotificationsServiceProvider; use Filament\Pages\Dashboard; use Filament\Panel; +use Filament\Schemas\SchemasServiceProvider; use Filament\Support\SupportServiceProvider; use Filament\Widgets\WidgetsServiceProvider; use Illuminate\Database\Eloquent\Factories\Factory; @@ -106,6 +109,9 @@ protected function getPackageProviders($app): array NotificationsServiceProvider::class, FilamentDeveloperLoginsServiceProvider::class, LivewireServiceProvider::class, + BladeIconsServiceProvider::class, + BladeHeroiconsServiceProvider::class, + SchemasServiceProvider::class, ]; } }