forked from stechstudio/filament-impersonate
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
abstract button and add pages button (stechstudio#27)
* abstract button and add pages button * contracts -> concerns --------- Co-authored-by: Joseph Szobody <[email protected]>
- Loading branch information
Showing
3 changed files
with
48 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace STS\FilamentImpersonate\Pages\Actions; | ||
|
||
use Filament\Facades\Filament; | ||
use Filament\Pages\Actions\Action; | ||
use STS\FilamentImpersonate\Concerns\Impersonates; | ||
|
||
class Impersonate extends Action | ||
{ | ||
use Impersonates; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this | ||
->label(__('filament-impersonate::action.label')) | ||
->icon('impersonate::icon') | ||
->action(fn ($record) => $this->impersonate($record)) | ||
->hidden(static fn ($record) => !static::allowed(Filament::auth()->user(), $record)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
|
||
namespace STS\FilamentImpersonate\Tables\Actions; | ||
|
||
use Filament\Facades\Filament; | ||
use Filament\Tables\Actions\Action; | ||
use STS\FilamentImpersonate\Concerns\Impersonates; | ||
|
||
class Impersonate extends Action | ||
{ | ||
use Impersonates; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
|
||
$this | ||
->iconButton() | ||
->icon('impersonate::icon') | ||
->action(fn ($record) => $this->impersonate($record)) | ||
->hidden(fn ($record) => !static::allowed(Filament::auth()->user(), $record)); | ||
} | ||
} |