Filament checks view before edit for row URL. Added a shared ViewRecord base that redirects to edit if canEdit() is true, so admins and managers get the editable form directly. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
9f42f730b8
commit
0500cab160
8 files changed
+26
-7
No files matched your search
@@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Pages;
|
||||
|
||||
use Filament\Resources\Pages\ViewRecord as BaseViewRecord;
|
||||
|
||||
class ViewRecord extends BaseViewRecord
|
||||
{
|
||||
public function mount(int|string $record): void
|
||||
{
|
||||
parent::mount($record);
|
||||
|
||||
$resource = static::getResource();
|
||||
|
||||
if ($resource::canEdit($this->record)) {
|
||||
$this->redirect($resource::getUrl('edit', ['record' => $this->record]));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user