Class "App\Models\Member" not found
Hey folks,
i tryed now so much. Fila Docs, Youtube (Code with D...), and so on. After Creating a fila-resource with
php artisan make:filament-resource Member
in app\Filament\Resources the folger "MemberResources" with its Pages Create, Edit, List ist created, also the MemberResource.php
In Browser, i can see the "Member" Link, but when i click on it it says
Undefined type 'App\Models\Member'
VS Code Extansion intelephense says, in Line 18 of MemberResource.php, there is an error at "protected static ?string $model = Member::class;" called "Undefined type 'App\Models\Member'.intelephense(P1009)"
i wanna learn filament with the doc and some youtube videos, but that error is - for me - unsolve able. yeah, i googled, but now after 1h i am still at the start of the error-solution.
Using: Laravel 11, Livewire 3.x, Filament 3.2 with the newest Panels
Whole project was created today.
BG Patrick
Solution:Jump to solution
actually, you need a Model to create a Resource
https://laravel.com/docs/11.x/eloquent#generating-model-classes...
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
4 Replies
Is there a model created in
app/Models/Member.php
?
Are you importing the model in the MemberResource.php?
use App\Models\Member;
no model was created 😦
Solution
actually, you need a Model to create a Resource
https://laravel.com/docs/11.x/eloquent#generating-model-classes
Laravel - The PHP Framework For Web Artisans
Laravel is a PHP web application framework with expressive, elegant syntax. We’ve already laid the foundation — freeing you to create without sweating the small things.
oh boy thank you. i missed two steps: creating the model, than migrate the db. those things where part of a long chapter... the resource chapter was much later... many thanks to your very quick answer!