#$view must not be accessed before initialization

3 messages · Page 1 of 1 (latest)

high rapids
#

What I am trying to do:
To go to the resource that is located inside a cluster. There I have custom index page for route('/').

What I did:
In every page Filament\Resources\Pages\Page inside that cluster for that resource I have this with corresponding blade file:

protected static string $view

Have tried to comment whole resource or pages for that resource, but the error persisted.
The only thing was when I have commented page for index route, it said:
Class "App\Filament\Clusters\CustomsCluster\CustomResource\Pages\CustomList" not found

My issue/the error:
The error can be seen in the screenshot.
Typed static property Filament\Pages\BasePage::$view must not be accessed before initialization

The question is, where it can be possible located?
In the internet was said that $view must be initialised for getView(), and it is in every view.

sacred stumpBOT
#

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

high rapids
#

Strangely, but in my case the error was that, canAccess() was not provided. Therefore, it could not access that resource at all.
After providing this:

public static function canAccess(): bool
    {
        return true;
    }

It it working fine. Still don't understand why it is the case, since in other cluster resources canAccess() is deafult, not rewritten in resource itself.