-
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.
- Loading branch information
Showing
38 changed files
with
566 additions
and
280 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
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 |
---|---|---|
@@ -1 +1,2 @@ | ||
- implement `database` provider | ||
- implement `Impersonation` resource |
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,9 @@ | ||
TODO: | ||
- ~~Buttons start and stop~~ | ||
- ~~Logging action~~ | ||
- ~~Jampire\MoonshineImpersonate\Http\Concerns\WithMoonShineAuthorization~~ | ||
- ~~Jampire\MoonshineImpersonate\Http\Middleware\ImpersonateMiddleware~~ | ||
- helpers file test? | ||
- ~~8.3 pipeline and require~~ | ||
- Translate to Belarusian | ||
- ~~test-type-coverage job~~ |
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
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
<x-moonshine::link icon="{{ $icon }}" href="{{ $route }}" class="{{ $class }}"> | ||
{{ $label }} | ||
</x-moonshine::link> | ||
@if($canStop) | ||
<x-moonshine::link-button icon="{{ $icon }}" href="{{ $route }}" class="{{ $class }}"> | ||
{{ $label }} | ||
</x-moonshine::link-button> | ||
@endif |
This file was deleted.
Oops, something went wrong.
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
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
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
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 |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
use Illuminate\Contracts\Support\Arrayable; | ||
use Illuminate\Contracts\View\View; | ||
use Jampire\MoonshineImpersonate\Support\Settings; | ||
use MoonShine\MoonShineUI; | ||
|
||
if (!function_exists('route_impersonate')) { | ||
/** | ||
|
@@ -52,3 +53,17 @@ function view_impersonate(string $key, array|Arrayable $data = [], array $mergeD | |
return view(Settings::ALIAS.'::'.$key, $data, $mergeData); | ||
} | ||
} | ||
|
||
if (!function_exists('toast_if')) { | ||
/** | ||
* @author Dzianis Kotau <[email protected]> | ||
*/ | ||
function toast_if(bool $condition, string $message, string $type = 'info'): void | ||
{ | ||
if (!$condition) { | ||
return; | ||
} | ||
|
||
MoonShineUI::toast(message: $message, type: $type); | ||
} | ||
} |
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,31 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Jampire\MoonshineImpersonate\UI\ActionButtons; | ||
|
||
use Illuminate\Contracts\Auth\Authenticatable; | ||
use Jampire\MoonshineImpersonate\Actions\EnterAction; | ||
use MoonShine\ActionButtons\ActionButton; | ||
|
||
/** | ||
* Class EnterImpersonationActionButton | ||
* | ||
* @author Dzianis Kotau <[email protected]> | ||
*/ | ||
final class EnterImpersonationActionButton | ||
{ | ||
public static function resolve(): ActionButton | ||
{ | ||
return ActionButton::make( | ||
label: trans_impersonate('ui.buttons.enter.label'), | ||
url: static fn (mixed $data): string => route_impersonate('enter', [ | ||
config_impersonate('resource_item_key') => $data->getKey(), | ||
]), | ||
) | ||
->canSee( | ||
callback: fn (Authenticatable $item): bool => app(EnterAction::class)->manager->canEnter($item), | ||
) | ||
->icon(config_impersonate('buttons.enter.icon')); | ||
} | ||
} |
Oops, something went wrong.