Skip to content

Commit 878438d

Browse files
authored
Merge pull request #44 from DutchCodingCompany/support-filament-4
Support filament 4
2 parents 6743340 + 0f857b6 commit 878438d

File tree

9 files changed

+54
-110
lines changed

9 files changed

+54
-110
lines changed

.github/workflows/phpstan.yml

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,14 @@ jobs:
1818
fail-fast: false
1919
matrix:
2020
os: [ubuntu-latest]
21-
php: [8.4, 8.3, 8.2, 8.1]
22-
laravel: [10.*, 11.*, 12.*]
21+
php: [8.4, 8.3, 8.2]
22+
laravel: [11.*, 12.*]
2323
stability: [prefer-stable]
2424
include:
25-
- laravel: 10.*
26-
testbench: 8.*
27-
phpstan_neon: phpstan.laravel-10.neon
2825
- laravel: 11.*
2926
testbench: 9.*
30-
phpstan_neon: phpstan.neon
3127
- laravel: 12.*
3228
testbench: 10.*
33-
phpstan_neon: phpstan.neon
34-
exclude:
35-
- laravel: 10.*
36-
php: 8.4
37-
- laravel: 11.*
38-
php: 8.1
39-
- laravel: 12.*
40-
php: 8.1
4129

4230
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.os }}
4331

@@ -60,4 +48,4 @@ jobs:
6048
run: composer show -D
6149

6250
- name: Run PHPStan
63-
run: vendor/bin/phpstan --error-format=github --configuration=${{ matrix.phpstan_neon }}
51+
run: vendor/bin/phpstan --error-format=github

.github/workflows/run-test.yml

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,14 @@ jobs:
2020
fail-fast: false
2121
matrix:
2222
os: [ubuntu-latest]
23-
php: [8.4, 8.3, 8.2, 8.1]
24-
laravel: [10.*, 11.*, 12.*]
23+
php: [8.4, 8.3, 8.2]
24+
laravel: [11.*, 12.*]
2525
stability: [prefer-stable]
2626
include:
27-
- laravel: 10.*
28-
testbench: 8.*
2927
- laravel: 11.*
3028
testbench: 9.*
3129
- laravel: 12.*
3230
testbench: 10.*
33-
exclude:
34-
- laravel: 10.*
35-
php: 8.4
36-
- laravel: 11.*
37-
php: 8.1
38-
- laravel: 12.*
39-
php: 8.1
4031

4132
name: PHP ${{ matrix.php }} - Laravel ${{ matrix.laravel }} - ${{ matrix.os }}
4233

README.md

Lines changed: 7 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,13 @@ This plugin allows you to enable one-click logins for your local Filament panels
1111

1212
## Installation
1313

14+
| Filament version | Package version | Readme |
15+
|---------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------|--------------------------------------------------------------------------------------|
16+
| [^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) |
17+
| [^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) |
18+
19+
20+
1421
You can install the package via composer.
1522

1623
```bash
@@ -61,33 +68,6 @@ FilamentDeveloperLoginsPlugin::make()
6168
->enabled(app()->environment('local'))
6269
```
6370

64-
### columns()
65-
66-
To customize the grid layout, you can use the columns() method. This method allows you to configure the grid layout based on your needs.
67-
68-
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.
69-
70-
Example:
71-
72-
```php
73-
// ...
74-
FilamentDeveloperLoginsPlugin::make()
75-
->columns() // default 2
76-
```
77-
78-
or you can use an array like this
79-
80-
```php
81-
// ...
82-
FilamentDeveloperLoginsPlugin::make()
83-
->columns([
84-
'sm' => 3,
85-
'xl' => 6,
86-
'2xl' => 8,
87-
])
88-
```
89-
90-
9171
### switchable()
9272

9373
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.

UPGRADING.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
# Upgrading
2+
3+
## Upgrading from 1.x to 2.x
4+
5+
Version 2.x supports filament 4.x and is not compatible with filament 3.x. Below are the breaking changes:
6+
7+
- 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.
8+
9+
That's it! If you find any bugs please let me know.

composer.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
}
2222
],
2323
"require": {
24-
"php": "^8.1",
25-
"filament/filament": "^3.0",
24+
"php": "^8.2",
25+
"filament/filament": "^4.0",
2626
"spatie/laravel-package-tools": "^1.15.0"
2727
},
2828
"require-dev": {
2929
"friendsofphp/php-cs-fixer": "^3.8",
3030
"larastan/larastan": "^2.9|^3.0",
3131
"nunomaduro/collision": "^7.0|^8.1",
32-
"orchestra/testbench": "^8.0|^9.0|^10.0",
32+
"orchestra/testbench": "^9.0|^10.0",
3333
"phpunit/phpunit": "^10.0|^11.0",
3434
"spatie/laravel-ray": "^1.26"
3535
},
@@ -63,6 +63,6 @@
6363
]
6464
}
6565
},
66-
"minimum-stability": "dev",
66+
"minimum-stability": "stable",
6767
"prefer-stable": true
6868
}

phpstan.laravel-10.neon

Lines changed: 0 additions & 17 deletions
This file was deleted.
Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,28 @@
11
@if(count($users) > 0)
2-
<div class="flex flex-col gap-y-6">
3-
4-
<div class="flex items-center justify-center text-center gap-x-4">
5-
<div class="border-t border-gray-200 grow h-px"></div>
6-
<p class="font-medium text-gray-500 dark:text-gray-100 shrink">
7-
{{ __('filament-developer-logins::auth.login-as') }}
8-
</p>
9-
<div class="border-t border-gray-200 grow h-px"></div>
10-
</div>
2+
<div class="fi-simple-header">
3+
<p>
4+
{{ __('filament-developer-logins::auth.login-as') }}
5+
</p>
116

127
@if ($errors->has('developer-logins-failed'))
13-
<div class="justify-center text-center">
14-
<p class="fi-fo-field-wrp-error-message text-danger-600 dark:text-danger-400">
15-
{{ $errors->first('developer-logins-failed') }}
16-
</p>
17-
</div>
8+
<p style="color: oklch(0.577 0.245 27.325);">
9+
{{ $errors->first('developer-logins-failed') }}
10+
</p>
1811
@endif
12+
</div>
1913

20-
<x-filament::grid
21-
:default="$columns['default'] ?? 1"
22-
:sm="$columns['sm'] ?? null"
23-
:md="$columns['md'] ?? null"
24-
:lg="$columns['lg'] ?? ($columns ? (is_array($columns) ? null : $columns) : 2)"
25-
:xl="$columns['xl'] ?? null"
26-
:two-xl="$columns['2xl'] ?? null"
27-
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)->class('fi-wi gap-4')"
28-
>
29-
@foreach ($users as $label => $credentials)
30-
<form action="{{ route('filament-developer-logins.login-as') }}" method="POST">
31-
@csrf
14+
@foreach ($users as $label => $credentials)
15+
<form action="{{ route('filament-developer-logins.login-as') }}" method="POST">
16+
<div class="fi-ac fi-width-full">
17+
@csrf
3218

33-
<input type="hidden" name="panel_id" value="{{ \Filament\Facades\Filament::getId() }}">
34-
<input type="hidden" name="credentials" value="{{ $credentials }}">
19+
<input type="hidden" name="panel_id" value="{{ \Filament\Facades\Filament::getId() }}">
20+
<input type="hidden" name="credentials" value="{{ $credentials }}">
3521

36-
<x-filament::button class="w-full" color="gray" outlined="true" type="submit">
37-
{{ "$label ($credentials)" }}
38-
</x-filament::button>
39-
</form>
40-
@endforeach
41-
</x-filament::grid>
42-
</div>
22+
<x-filament::button type="submit" outlined="true" color="gray">
23+
{{ "$label ($credentials)" }}
24+
</x-filament::button>
25+
</div>
26+
</form>
27+
@endforeach
4328
@endif

src/FilamentDeveloperLoginsPlugin.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
use DutchCodingCompany\FilamentDeveloperLogins\Exceptions\ImplementationException;
88
use Filament\Contracts\Plugin;
99
use Filament\Facades\Filament;
10-
use Filament\Forms\Concerns\HasColumns;
1110
use Filament\Panel;
11+
use Filament\Schemas\Concerns\HasColumns;
1212
use Filament\Support\Concerns\EvaluatesClosures;
1313

1414
class FilamentDeveloperLoginsPlugin implements Plugin

tests/TestCase.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
namespace DutchCodingCompany\FilamentDeveloperLogins\Tests;
44

5+
use BladeUI\Heroicons\BladeHeroiconsServiceProvider;
6+
use BladeUI\Icons\BladeIconsServiceProvider;
57
use DutchCodingCompany\FilamentDeveloperLogins\FilamentDeveloperLoginsPlugin;
68
use DutchCodingCompany\FilamentDeveloperLogins\FilamentDeveloperLoginsServiceProvider;
79
use DutchCodingCompany\FilamentDeveloperLogins\Http\Controllers\DeveloperLoginsController;
@@ -13,6 +15,7 @@
1315
use Filament\Notifications\NotificationsServiceProvider;
1416
use Filament\Pages\Dashboard;
1517
use Filament\Panel;
18+
use Filament\Schemas\SchemasServiceProvider;
1619
use Filament\Support\SupportServiceProvider;
1720
use Filament\Widgets\WidgetsServiceProvider;
1821
use Illuminate\Database\Eloquent\Factories\Factory;
@@ -29,6 +32,8 @@ protected function setUp(): void
2932
{
3033
parent::setUp();
3134

35+
Filament::setCurrentPanel($this->panelName);
36+
3237
Factory::guessFactoryNamesUsing(
3338
fn (
3439
string $modelName,
@@ -104,6 +109,9 @@ protected function getPackageProviders($app): array
104109
NotificationsServiceProvider::class,
105110
FilamentDeveloperLoginsServiceProvider::class,
106111
LivewireServiceProvider::class,
112+
BladeIconsServiceProvider::class,
113+
BladeHeroiconsServiceProvider::class,
114+
SchemasServiceProvider::class,
107115
];
108116
}
109117
}

0 commit comments

Comments
 (0)