This is the code I have so far:
Web.php
Route::get('/{uri}', 'PageController@show')->name('page.show');
PageController
// Show the requested page
public function show(Page $page)
{
return view('templates.page', compact('page'));
}
Page model
public function getRouteKeyName()
{
return 'uri';
}
My question is how come the Route-model-binding is not working and not finding the page in the controller even though I have changed the route key name. It just has an empty model in the controller and has not found the page.