I have this problem where laravel ModelNotFound exeption handler catches all exceptions not only releated to eloquent.
I have added to global.php
this code:
// this is default code
App::error(function(Exception $exception, $code)
{
Log::error($exception);
});
// added code
App::error(function(ModelNotFoundException $exception)
{
//do something, in my case redirect to 404 or whaterver
});
Controller has this partial code:
namespace CompanyName\Admin;
class PromosController extends CompanyNameAdminController {
public function show($id) {
$promo = Promo::findOrFail($id);
}
}
Now if I try to pass id that dont exist I will recieve white page, code in app error does not execute. Other problem is that this App:error catches all Exeptions, like not found conrollers etc, basicly every exeption.
What I am doing wrong? I got this idea from Laracasts Exeptions handling episode, but somehow Im missing something. Because I get no feedback form Laravel about problem I am stuck. I suspect that namespaces has something to do with it but I am not sure..
EDIT: At last I found some feedback in console: 500 Internal Server Error HTML: Reload the page to get source for: http://cms.dev/admin/promos/533