How to override all ViewRecord pages getView() function

I'm make a trait to get simple set $view file of page view to my custom view file.
namespace App\Filament\Concerns;

use Filament\Resources\Pages\EditRecord;
use Filament\Resources\Pages\ViewRecord;


trait FastRelationManagerTab
{
public function getView(): string
{
if ($this instanceof EditRecord) {
return 'filament.resources.edit-record';
} elseif ($this instanceof ViewRecord) {
return 'filament.resources.view-record';
} else {
return parent::$view;
}
}
}
namespace App\Filament\Concerns;

use Filament\Resources\Pages\EditRecord;
use Filament\Resources\Pages\ViewRecord;


trait FastRelationManagerTab
{
public function getView(): string
{
if ($this instanceof EditRecord) {
return 'filament.resources.edit-record';
} elseif ($this instanceof ViewRecord) {
return 'filament.resources.view-record';
} else {
return parent::$view;
}
}
}
I wonder that If I want to set to all ViewRecord pages, how I can do so. I wish I can do on ServiceProvider, Please advise, I want to set view file something like 'filament.resources.view-record'
1 Reply
Zen Nitiruj
Zen NitirujOP4mo ago
I am thinking another way around. If I want to do a plugin to fix this. The first question would be can I publish the view filament-panels::resources.pages.view-record ? I got this php artisan vendor:publish --tags="filament-panels-views " But It comes out all views. Is there anyway to specific a single file.
Want results from more Discord servers?
Add your server