Deploy / deploy (push) Successful in 16s
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>
20 lines
427 B
PHP
20 lines
427 B
PHP
<?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]));
|
|
}
|
|
}
|
|
}
|