0

im trying to implement code of 404 page in my website. Im using this code in my filters.php but i also tried to use in global.php

App::missing(function($exception)
{
 return View::make('404');
}

as a result im getting this error:

Symfony \ Component \ Debug \ Exception \ FatalErrorException
Call to a member function getAction() on a non-object
1

3 Answers 3

1

i do it an aother way. What is going to happen when 404 is raised is normally declared in app/start/global.php

It should looks like that :

App::error(function($exception, $code)
{
    switch ($code)
    {
        case 403:
            return Response::view('errors.403', array(), 403);
        case 404:
            return Response::view('errors.404', array(), 404);
    }
}

This just called the app/views/errors/404.blade.php anytime laravel raised a 404 or if you decide to manually call App::abort(404);

Hope it helps.

0

I googled more about this and how i understand it problem comes from nginx. could be? btw it is working without blade templating but i need it. so need to find out how to fix it

0

That look like in the views or composer of the layout or your 404 page. you have something like:

Route::getCurrentRoute()->getAction()

or

Route::current()->getAction()

Or as far I remember Route::getCurrentRoute when 404 would be null and then it explains your error...

I use to check if the current Route is instance of Route by:

$currentRoute = \Route::getCurrentRoute();
if ($currentRoute instanceof Route) {
    // Do What you want here
    $currentRoute->getAction()//...
}
1
  • Of course a Route is a Route, why the heck do you want to check that Jan 2, 2015 at 13:32

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.