What happens when you try this?
Route::bind('strategy', function ($value)
{
dd($value); // Check if the value is correct
// return \App\Article\Strategy::where('slug', $value)->first();
});
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
What I want is the route model binding functionality (accessing Strategy $strategy as a method argument) for custom routes which use title slugs rather than ids.
I have this in RSP
Route::bind('strategy', function($value) {
return \App\Article\Strategy::where('slug', $value)->first();
});
and this in my routes file:
Route::get(\Lang::get('slugs.strategy').'/{strategy}', 'ArticleController@showStrategy');
It simply does not work. RouteServiceProvider is loaded in app.php, yet I cannot dump anything in it. Accessing Strategy $strategy results in an empty skeleton object. What's going on here?
// @JeffreyWay, pressing altgr in the laracasts editor does not work, please fix it
A composer update from 5.0.0. to 5.0.2. solves the problem.
Please or to participate in this conversation.