In your show
method you may use something like this:
public function show($id)
{
$artist = Artist::find($id);
if($artist) {
return View::make('artists.show', compact('artist'))->with(...)
}
else {
return View::make('errors.notfound')->withID($id);
}
}
In your views
folder create a folder named errors
(if not present) and in this folder create a view
named notfound.blade.php
and in this view file you'll get the $id
so you may show something useful with/without the id
.
Alternatively, you may register a global NotFoundHttpException
exception handler in your app/start/global.php
file like this:
App::error(function(Symfony\Component\HttpKernel\Exception\NotFoundHttpException $e) {
// Use $e->getMessage() to get the message from the object
return View::make('errors.notfound')->with('exception', $e);
});