Customizing The Key Name
If you would like model binding to use a database column other thanid
when retrieving a given model class, you may override thegetRouteKeyName
method on the Eloquent model:/** * Get the route key for the model. * * @return string */ public function getRouteKeyName() { return 'slug'; }