bobbybouwmann

@kamlesh It means that the route is not defined correctly or you don't return a correct view!

graham
graham
3 years ago (39,445 XP)

@bestmomo I take it back, 404 pages do work locally. I must have done something dumb.

alenoosh

Hi all

What if we want to write an exception handler for one laravel 5 package, such that it displays the custom 404 view of that package. Actually I want to know how should I register the Exception Handler of a package inside the provider of that package.

Thanks in advance for your help.

AlanRezende

@lockeyo For me in L5 I can just add a 404.blade.php to the errors view folder and it does all automaticaly.

alenoosh

Thanks @lockeyo for your reply, I want to have a separate 404 view for that package, I have a 404 view file inside the view folder of the package but I need to register this to get it working.

vineetgarg90
alenoosh

Thanks @vineetgarg90 for your reply, actually I want to modify my custom laravel package to do this.

I want to write a separate exception handler for one custom Laravel5 package, such that it displays the custom 404 view of that package. Actually I want to know how should I register the Exception Handler of a package inside the provider of that package.

For example, if name of my package is testPackage, my ExceptionHandler file is located in : vendor/testPackage/src/Exceptions/testExceptionHandler.php

And the 404 view file is located in : vendor/testPackage/src/views/404.blade.php

callam

@alenoosh any luck doing this?

jhonjaider1000

For Laravel >= 5 versions, create in the "resources/views/errors" directory, the "404.blade.php" file with the template or required functions. ; )

altafneva

@bestmomo I tried exactly whatever you said but now it gives me HTTP ERROR 500 and the page is saying that mydomain.com is currently unable to handle this request. I have created a 404.blade.php view and placed it under proper directory. Still its not working for me. Though on localhost its working but on live site its not.

bestmomo
bestmomo
1 year ago (356,570 XP)

@altafneva

Looks like a server requirements issue. Check this list.

ThapliyalManoj

What you have to do In ->views/errors ->add redirect location to your package or folder ->@extends('your_location.errors.404')

ramakrishnav

@bestmomo it worked, but not logging any thing in logs i need both log and view

Please sign in or create an account to participate in this conversation.