Skip to content

Event::override not working for 500 events #78

Closed
@tester5

Description

@tester5

I am able to use the Event::Override function successfully with the 404 event but not the 500 event. I simply wish the event to redirect to the front page with a flash message, as I am able to do fine with 404 events.

http://stackoverflow.com/questions/14276741/custom-error-500-page-not-displaying-using-eventoverride-laravel

Is there something else I need to do to get the 500 events also redirecting to my front page? see code below in routes.php file:

Event::listen('404', function() {
return Response::error('404');
});

Event::listen('500', function() {
return Response::error('500');
});

Event::override('404', function() {
Session::flash('error', 'Error 404 - Not Found. The page you are looking for is either invalid or may no longer exist. You are now back at our home page.');
return Redirect::to_route('home');
});

Event::override('500', function() {
Session::flash('error', 'Error 500 - Internal Server Error. Something went wrong on our servers, apologies for that. Please contact us if this persists.');
return Redirect::to_route('home');
});

I'm not sure if this is an issue or something I've missed. If it's not an issue, I'd be grateful for some link highlighting how this should be done, or a quick one liner.

many thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions