F
Filament12mo ago
Abi

Error when enabling user profile on a custom filament panel

enabling
->profile(CustomPage::class)
->profile(CustomPage::class)
method on a custom panel provider throws the following error
Route [filament.user.auth.profile] not defined..
Route [filament.user.auth.profile] not defined..
Solution:
If you change the userprovider path from 'user' to another it should work
Jump to solution
23 Replies
LeandroFerreira
LeandroFerreira12mo ago
What is the filament version? Did it work without the CustomPage?
Abi
AbiOP12mo ago
@Leandro Ferreira using the latest filament version If I use the profile() method on the default AdminPanelProvider it works. If I create a new Panel and then try to enable the profile method on that. then I get this error even passing no parameters to the profile method on the new Panel Provider UserPanelProvider yielded the same error
DrByte
DrByte12mo ago
Please post the code which defines both panels
Abi
AbiOP12mo ago
Gist
AdminPanelProvider.php
GitHub Gist: instantly share code, notes, and snippets.
Abi
AbiOP12mo ago
added both panel providers
LeandroFerreira
LeandroFerreira12mo ago
do you have middlewares, what is the content? please confirm the filament version.. 3.?.? There is a EditProfile page in the user provider...
Abi
AbiOP12mo ago
@Leandro Ferreira I updated the Middleware and added the EditProfile class. The filament version is v3.1.29 I tried to use ->profile() and ->profile(EditorProfile::class) to see if one of the could be causing the issue
LeandroFerreira
LeandroFerreira12mo ago
->pages([
Dashboard::class,
EditProfile::class
])
->pages([
Dashboard::class,
EditProfile::class
])
Try to remove EditProfile::class in the pages array and use ->profile()
Abi
AbiOP12mo ago
here is my code updated as you requested
LeandroFerreira
LeandroFerreira12mo ago
Could you share this project in the github?
Abi
AbiOP12mo ago
its a closed source of a client project, don't think I can share, if you need any other details, I can share here. Will sharing the error page or flare help?
Abi
AbiOP12mo ago
Flare
Route [filament.user.auth.profile] not defined. - The error occurred at https://tdba2.test/user/dashboard
Abi
AbiOP12mo ago
i can try to reproduce this on a separate laravel project
LeandroFerreira
LeandroFerreira12mo ago
php artisan route:list --name=profile should show the filament.user.auth.profile route. It is created with $panel->profile() try to clear cache php artisan route:clear or php artisan optimize:clear if it doesn't work, remove the $panel->profile() and try to add this route in the routes/web.php
Route::get('/user/profile', Filament\Pages\Auth\EditProfile::class);
Route::get('/user/profile', Filament\Pages\Auth\EditProfile::class);
Abi
AbiOP12mo ago
php artisan route:list --name=profile clearing cache doesn't help removed $panel->profile() and added the route you and that works I am able to go to the Profile page with this, it doesn't add the Edit Profile to the User Menu but enabling ->profile() after adding the route throws the error
LeandroFerreira
LeandroFerreira12mo ago
An issue in the profile.show with your jetstream route Same route, user/profile
Abi
AbiOP12mo ago
so, I cannot use jetstream with filament? I removed Jetstream completely and when I enable profile I don't get an error, but when I go to the Profile page, I get an error
Call to undefined method App\Models\User::getProfilePhotoUrlAttribute()
Call to undefined method App\Models\User::getProfilePhotoUrlAttribute()
LeandroFerreira
LeandroFerreira12mo ago
I think you can use it but you need to customize the routes, filament or jetstream. Routes are unique
Abi
AbiOP12mo ago
ok, I understand, I just wanted to be able to use some of the functionality that jetstream offers within Filament on custom filament pages and jetstream offers options to customize/override the login and register page.
Solution
LeandroFerreira
LeandroFerreira12mo ago
If you change the userprovider path from 'user' to another it should work
Abi
AbiOP12mo ago
ah ok, so that is the issue. if I named it customer, then this would be fixed?
LeandroFerreira
LeandroFerreira12mo ago
Should work
Abi
AbiOP12mo ago
ok, that definitely helped. thank you for this. I will keep this in mind for the future. I appreciate the help renaming the path from user to something else worked now, I need to find a way to override the profile page to use the Jetstream components on a Custom Filament page Changing the ->profile() method to use a custom Filament Page, brings the error back @Leandro Ferreira any way to customize adding menu items on the user menu? nvm, found it thanks for the help so far
Want results from more Discord servers?
Add your server