#How to override all ViewRecord pages getView() function

3 messages · Page 1 of 1 (latest)

ornate cedar
#

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;
        }
    }
}

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'

hard crystalBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> ✅ Mark Solution

ornate cedar
#

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 ?