URL

Good evening, is there a way to change how the urls link ? For example i have a user with uuid as an id. Can i change the url to mydomain.com/admin/username instead of the uuid ?
3 Replies
Saade
Saade9mo ago
add this to your model
public function getRouteKeyName(): string
{
return 'uuid';
}
public function getRouteKeyName(): string
{
return 'uuid';
}
einnlleinhatt_
einnlleinhatt_9mo ago
Any other way instead of adding this to each model ? It does work tho thanks.
Saade
Saade9mo ago
Create a base model that extends eloquent model, and make every model extend that base model or, replace {record} in the resource route with {record:slug} but i think the getRouteKeyName is a better aproach