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

Undefined Variable problem on Laravel 9.x
Publish date: 2022-03-06 | Comments: 3
I want to make multiple foreign keys in Laravel, can I?
Publish date: 2022-01-27 | Comments: 5
How can I use arabic words, paragraphs in the faker?
Publish date: 2022-03-06 | Comments: 1
Laravel API POST method returns 419
Publish date: 2022-08-03 | Comments: 1
API CORS error in Laravel 9x
Publish date: 2022-08-03 | Comments: 2