user image

Eslam Zedan
Published in : 2022-02-21

How to pass valiables to 404 error page in laravel?

Laravel

In my laravel project, I have created a 404 view file at resources/views/errors/404.blade.php

Put I want to pass some variables to use it at the view.

Any help with that.

 

Thanks in advance.

Comments

Yasen Sayed Date : 2022-02-21

Best answers

8

Best answers

8

You can use a view composer :

 

\View::composer('errors/404', function($view){ $view->with('myVariable', $data);});

Eslam Zedan Date : 2022-02-21

Use it in where exactly ??

Leave a comment

Join us

Join our community and get the chance to solve your code issues & share your opinion with us

Sign up Now

Related posts

Laravel clear cache files manually
Publish date: 2022-03-02 | Comments: 2