wip
This commit is contained in:
1 parent
ae6bb58972
commit
054654fb9c
18 files changed
+1325
-85
No files matched your search
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
namespace App\Traits;
|
||||
|
||||
use Filament\Actions\Action;
|
||||
use Filament\Resources\Pages\Page;
|
||||
|
||||
trait HasBackUrl
|
||||
{
|
||||
/**
|
||||
* überschreibt in EditRecords CancelAction da diese history based schritt für schit zurück ging.
|
||||
* mit diese änderung füht der Link direct zurück zur projekte liste.
|
||||
*/
|
||||
public ?string $backUrl = null;
|
||||
|
||||
public function mount($record = null): void
|
||||
{
|
||||
$this->backUrl = url()->previous();
|
||||
parent::mount($record);
|
||||
}
|
||||
|
||||
protected function getRedirectUrl(): string // <- return type is string to be compatible with EditRecord & CreateRecord
|
||||
{
|
||||
return $this->backUrl;
|
||||
}
|
||||
|
||||
protected function getCancelFormAction(): Action
|
||||
{
|
||||
return parent::getCancelFormAction()
|
||||
->url(fn (Page $livewire) => $livewire->backUrl ?? static::getResource()::getUrl());
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user