F
Filament5mo ago
kobe

Route not defined.

Route [filament.admin.resources.registration-requests.index] not defined.
No description
15 Replies
jigsaw
jigsaw5mo ago
you can use
RegistrationRequestResource::getUrl()
RegistrationRequestResource::getUrl()
don't forget namespace
kobe
kobeOP5mo ago
where writing this
jigsaw
jigsaw5mo ago
where did you write
route('filament.admin.resources.registration-requests.index')
route('filament.admin.resources.registration-requests.index')
?
Dennis Koch
Dennis Koch5mo ago
You did not provide any info. So what is wrong? If the message just comes out of nowhere it's very likely a cache issue
kobe
kobeOP5mo ago
public static function getPages(): array
{
Log::info('Registering RegistrationRequestResource');

return [
'index' => Pages\ListRegistrationRequests::route('/'),
'create' => Pages\CreateRegistrationRequest::route('/create'),
'edit' => Pages\EditRegistrationRequest::route('/{record}/edit'),
];
}
public static function getPages(): array
{
Log::info('Registering RegistrationRequestResource');

return [
'index' => Pages\ListRegistrationRequests::route('/'),
'create' => Pages\CreateRegistrationRequest::route('/create'),
'edit' => Pages\EditRegistrationRequest::route('/{record}/edit'),
];
}
IVE SOLVED IT BY MANNUALLY ADING THE ROUTES IN THE WEB.PHP LIKE THIS :
Route::group(['prefix' => 'filament', 'as' => 'filament.'], function () {
Route::get('admin/resources/registration-requests', [RegistrationRequestResource::class, 'index'])
->name('admin.resources.registration-requests.index');
Route::get('admin/resources/registration-requests/create', [RegistrationRequestResource::class, 'create'])
->name('admin.resources.registration-requests.create');
Route::get('admin/resources/registration-requests/{record}/edit', [RegistrationRequestResource::class, 'edit'])
->name('admin.resources.registration-requests.edit');
});
Route::group(['prefix' => 'filament', 'as' => 'filament.'], function () {
Route::get('admin/resources/registration-requests', [RegistrationRequestResource::class, 'index'])
->name('admin.resources.registration-requests.index');
Route::get('admin/resources/registration-requests/create', [RegistrationRequestResource::class, 'create'])
->name('admin.resources.registration-requests.create');
Route::get('admin/resources/registration-requests/{record}/edit', [RegistrationRequestResource::class, 'edit'])
->name('admin.resources.registration-requests.edit');
});
which is not best practice
Dennis Koch
Dennis Koch5mo ago
You shouldn't do this. If the routes don't appear there's probably some issue with caching
kobe
kobeOP5mo ago
i tried clearing everything https://discord.com/channels/883083792112300104/1261005711953891328/1261005711953891328 this guy had the same error before
jigsaw
jigsaw5mo ago
where did you write this getPages method? didn't understand why did you write all pages separately? shouldn't they be like this:
'index' => Pages\RegistrationRequestResource::route('/'),
'create' => Pages\RegistrationRequestResource::route('/create'),
'edit' => Pages\RegistrationRequestResource::route('/{record}/edit'),
'index' => Pages\RegistrationRequestResource::route('/'),
'create' => Pages\RegistrationRequestResource::route('/create'),
'edit' => Pages\RegistrationRequestResource::route('/{record}/edit'),
this is default. are you doing something non-default?
kobe
kobeOP5mo ago
i wrote this in app/Filament/Resources/RegistrationRequestResource.php
jigsaw
jigsaw5mo ago
ok, please try this
kobe
kobeOP5mo ago
its exactly what i did
No description
jigsaw
jigsaw5mo ago
no you didn't please read carefully
// your version
Pages\ListRegistrationRequests::route('/'),

// default
Pages\RegistrationRequestResource::route('/'),
// your version
Pages\ListRegistrationRequests::route('/'),

// default
Pages\RegistrationRequestResource::route('/'),
did you spot the difference?
kobe
kobeOP5mo ago
mine are customized that why you see a naming difference
No description
jigsaw
jigsaw5mo ago
could you send a demo repo?
Dennis Koch
Dennis Koch5mo ago
Yeah, jigsaw is right. RegistrationRequestResource::class, 'create' this looks more than a controller, than the typical Livewire pages we have Quite weird that this works. But this looks okay to me
Want results from more Discord servers?
Add your server