Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 3 additions & 15 deletions .github/workflows/phpstan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand All @@ -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
13 changes: 2 additions & 11 deletions .github/workflows/run-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}

Expand Down
34 changes: 7 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -61,33 +68,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.
Expand Down
9 changes: 9 additions & 0 deletions UPGRADING.md
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
Expand Down Expand Up @@ -63,6 +63,6 @@
]
}
},
"minimum-stability": "dev",
"minimum-stability": "stable",
"prefer-stable": true
}
17 changes: 0 additions & 17 deletions phpstan.laravel-10.neon

This file was deleted.

55 changes: 20 additions & 35 deletions resources/views/components/developer-logins.blade.php
Original file line number Diff line number Diff line change
@@ -1,43 +1,28 @@
@if(count($users) > 0)
<div class="flex flex-col gap-y-6">

<div class="flex items-center justify-center text-center gap-x-4">
<div class="border-t border-gray-200 grow h-px"></div>
<p class="font-medium text-gray-500 dark:text-gray-100 shrink">
{{ __('filament-developer-logins::auth.login-as') }}
</p>
<div class="border-t border-gray-200 grow h-px"></div>
</div>
<div class="fi-simple-header">
<p>
{{ __('filament-developer-logins::auth.login-as') }}
</p>

@if ($errors->has('developer-logins-failed'))
<div class="justify-center text-center">
<p class="fi-fo-field-wrp-error-message text-danger-600 dark:text-danger-400">
{{ $errors->first('developer-logins-failed') }}
</p>
</div>
<p style="color: oklch(0.577 0.245 27.325);">
{{ $errors->first('developer-logins-failed') }}
</p>
@endif
</div>

<x-filament::grid
:default="$columns['default'] ?? 1"
:sm="$columns['sm'] ?? null"
:md="$columns['md'] ?? null"
:lg="$columns['lg'] ?? ($columns ? (is_array($columns) ? null : $columns) : 2)"
:xl="$columns['xl'] ?? null"
:two-xl="$columns['2xl'] ?? null"
:attributes="\Filament\Support\prepare_inherited_attributes($attributes)->class('fi-wi gap-4')"
>
@foreach ($users as $label => $credentials)
<form action="{{ route('filament-developer-logins.login-as') }}" method="POST">
@csrf
@foreach ($users as $label => $credentials)
<form action="{{ route('filament-developer-logins.login-as') }}" method="POST">
<div class="fi-ac fi-width-full">
@csrf

<input type="hidden" name="panel_id" value="{{ \Filament\Facades\Filament::getId() }}">
<input type="hidden" name="credentials" value="{{ $credentials }}">
<input type="hidden" name="panel_id" value="{{ \Filament\Facades\Filament::getId() }}">
<input type="hidden" name="credentials" value="{{ $credentials }}">

<x-filament::button class="w-full" color="gray" outlined="true" type="submit">
{{ "$label ($credentials)" }}
</x-filament::button>
</form>
@endforeach
</x-filament::grid>
</div>
<x-filament::button type="submit" outlined="true" color="gray">
{{ "$label ($credentials)" }}
</x-filament::button>
</div>
</form>
@endforeach
@endif
2 changes: 1 addition & 1 deletion src/FilamentDeveloperLoginsPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
use DutchCodingCompany\FilamentDeveloperLogins\Exceptions\ImplementationException;
use Filament\Contracts\Plugin;
use Filament\Facades\Filament;
use Filament\Forms\Concerns\HasColumns;
use Filament\Panel;
use Filament\Schemas\Concerns\HasColumns;
use Filament\Support\Concerns\EvaluatesClosures;

class FilamentDeveloperLoginsPlugin implements Plugin
Expand Down
8 changes: 8 additions & 0 deletions tests/TestCase.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -29,6 +32,8 @@ protected function setUp(): void
{
parent::setUp();

Filament::setCurrentPanel($this->panelName);

Factory::guessFactoryNamesUsing(
fn (
string $modelName,
Expand Down Expand Up @@ -104,6 +109,9 @@ protected function getPackageProviders($app): array
NotificationsServiceProvider::class,
FilamentDeveloperLoginsServiceProvider::class,
LivewireServiceProvider::class,
BladeIconsServiceProvider::class,
BladeHeroiconsServiceProvider::class,
SchemasServiceProvider::class,
];
}
}