andyg1
207
10
Laravel

Route Model Binding - optional RouteKeyName

Posted 1 year ago by andyg1

On my front-end I am using the slug field to access the objects e.g.

site.dev/slug-of-title/

and have set it using the getRouteKeyName() method.

On my admin side of the site, I am building the CRUD pages for all these things. I wanted my URLs to be the simple ones e.g.

site.dev/admin/object/1
site.dev/admin/object/3/edit

etc

But the system is still expecting to access the resource from the slug, not the id.

Is it possible to optionally override this so I don't have the slug-ified URLs for my admin section?

(I should state that I am using resource controllers...) Thanks

Please sign in or create an account to participate in this conversation.

Reply to

Use Markdown with GitHub-flavored code blocks.