Route [participants.edit] not defined.

Hi i already have Resourcepage Participants and pages edit. Already registered getPages edit to. but why it is still show Route [participants.edit] not defined. Thank you
Solution:
try
['record' => $record->rootInformationId]
['record' => $record->rootInformationId]
...
Jump to solution
19 Replies
Dushmanta
Dushmanta3mo ago
Share a snippet of your code and do try php artisan optimize:clear
DMB
DMB3mo ago
me working ... redirect()->route('filament.admin.resources.box-gpais-records.edit');
Dushmanta
Dushmanta3mo ago
@thyk123
public static function getPages(): array
{
return [
'index' => ListUsers::route('/'),
'create' => CreateUser::route('/create'),
'edit' => EditUser::route('/{record}/edit'),
];
}
public static function getPages(): array
{
return [
'index' => ListUsers::route('/'),
'create' => CreateUser::route('/create'),
'edit' => EditUser::route('/{record}/edit'),
];
}
It should look like this, don't forget to add the {record}
thyk123
thyk1233mo ago
public static function getPages(): array
{
return [
'index' => Pages\ListParticipants::route('/'),
//'create' => Pages\CreateParticipant::route('/create'),
'edit' => Pages\EditParticipant::route('/{record}/edit'),

];
}
public static function getPages(): array
{
return [
'index' => Pages\ListParticipants::route('/'),
//'create' => Pages\CreateParticipant::route('/create'),
'edit' => Pages\EditParticipant::route('/{record}/edit'),

];
}
Action::make('All')

->url(fn (Participant $record): string => route('participants.edit', $record))
->openUrlInNewTab(),

Action::make('All')

->url(fn (Participant $record): string => route('participants.edit', $record))
->openUrlInNewTab(),

this is my code @Dushmanta already try
php artisan optimize:clear
php artisan optimize:clear
but still not working
thyk123
thyk1233mo ago
route are listed in
route:list
route:list
No description
Rolland
Rolland3mo ago
try
ParticipantResource::getUrl('edit', $record);
ParticipantResource::getUrl('edit', $record);
swap with route()
thyk123
thyk1233mo ago
->url(fn (Participant $record): string => ParticipantResource::getUrl('edit', $record))
->url(fn (Participant $record): string => ParticipantResource::getUrl('edit', $record))
like this? i still get error like this
Filament\Resources\Resource::getUrl(): Argument #2 ($parameters) must be of type array, App\Models\Participant given, called in D:\nylc2\app\Filament\Resources\ParticipantResource.php on line 105
Filament\Resources\Resource::getUrl(): Argument #2 ($parameters) must be of type array, App\Models\Participant given, called in D:\nylc2\app\Filament\Resources\ParticipantResource.php on line 105
Rolland
Rolland3mo ago
ohh.. try
ParticipantResource::getUrl('edit', ['record' => $record])
ParticipantResource::getUrl('edit', ['record' => $record])
let me know if its working..
Vp
Vp3mo ago
Your route name (from screenshot) is filament.admin.resources.participants.edit but you provide participants.edit only.. you can see the difference here
thyk123
thyk1233mo ago
@Rolland thank yoou very muchh it's work, so gratefull you help me with this error but can i ask more question? the $record is show id right, how about get another column value instead id?
Rolland
Rolland3mo ago
you mean slug?
thyk123
thyk1233mo ago
ohhh, thank you for explanation about that
Rolland
Rolland3mo ago
this you can set it up in your model
public function getRouteKeyName()
{
return 'slug';
}
public function getRouteKeyName()
{
return 'slug';
}
thyk123
thyk1233mo ago
@Rolland yes but i want to still id as default and can get slug , can i do that?
Rolland
Rolland3mo ago
i dont follow. can you give me an example?
thyk123
thyk1233mo ago
oh im sorry. i mean i want to make an action url to another resource page like this:
->url(fn (Participant $record): string => RootInformationResource::getUrl('edit', ['record' => $record]))
->url(fn (Participant $record): string => RootInformationResource::getUrl('edit', ['record' => $record]))
so this is inside participant resource that have action link to RootInformation, but i want to get from another column called rootinformationId inside participant model so i can get url that had the rootinformationid instead the participant id
Solution
Rolland
Rolland3mo ago
try
['record' => $record->rootInformationId]
['record' => $record->rootInformationId]
thyk123
thyk1233mo ago
@Rolland thank you very much! it's work!. I hope your day is great!
Rolland
Rolland3mo ago
no problem. glad that i could be any help..