Laravel 7 includes some useful improvements to route model binding. You may now specify a custom route key name without adding a getRouteKeyName()
method to the associated model. Instead, simply add the custom key as part of the route declaration: /posts/{post:slug}
. Additionally, when specifying custom keys, Laravel will automatically scope them to a parent relationship if relevant.
Published on Mar 6th, 2020.