mirror of
https://github.com/jez500/pricebuddy.git
synced 2026-11-24 19:58:13 +01:00
31 lines
733 B
PHP
Executable File
31 lines
733 B
PHP
Executable File
<?php
|
|
|
|
namespace App\Filament\Resources\StoreResource\Pages\Traits;
|
|
|
|
use Filament\Actions\Action;
|
|
|
|
trait TestAfterEdit
|
|
{
|
|
protected bool $testAfterCreate = false;
|
|
|
|
public function getSaveAndTestAction(string $label): Action
|
|
{
|
|
return Action::make('createAndTest')
|
|
->label($label)
|
|
->action('saveAndTest')
|
|
->keyBindings(['mod+shift+t'])
|
|
->color('gray');
|
|
}
|
|
|
|
protected function getRedirectUrl(): string
|
|
{
|
|
if ($this->testAfterCreate) {
|
|
$this->testAfterCreate = false;
|
|
|
|
return static::getResource()::getUrl('test', ['record' => $this->record->getKey()]);
|
|
}
|
|
|
|
return static::getResource()::getUrl('index');
|
|
}
|
|
}
|