Improve exception handling and model binding
This commit is contained in:
parent
e9ca934cb4
commit
0fca80e7e4
22 changed files with 148 additions and 82 deletions
|
@ -12,7 +12,7 @@ class PlacesController extends Controller
|
|||
/**
|
||||
* Show all the places.
|
||||
*
|
||||
* @return \Illuminate\View\View
|
||||
* @return View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
|
@ -24,13 +24,11 @@ class PlacesController extends Controller
|
|||
/**
|
||||
* Show a specific place.
|
||||
*
|
||||
* @param string $slug
|
||||
* @return \Illuminate\View\View
|
||||
* @param Place $place
|
||||
* @return View
|
||||
*/
|
||||
public function show(string $slug): View
|
||||
public function show(Place $place): View
|
||||
{
|
||||
$place = Place::where('slug', '=', $slug)->firstOrFail();
|
||||
|
||||
return view('singleplace', ['place' => $place]);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue