Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

how to use model not found exception handler laravel

try {
    $menus = Menu::where('parent_id', '>', 100)->firstOrFail();
}catch (IlluminateDatabaseEloquentModelNotFoundException $e) {
    $message = 'Invalid parent_id.';
    return Redirect::to('error')->with('message', $message);
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #model #exception #handler #laravel
ADD COMMENT
Topic
Name
9+4 =