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

Get user location (city - country) from his IP address
Publish date: 2022-03-02 | Comments: 2
How I can exclude private property from var_dump or object?
Publish date: 2022-02-22 | Comments: 2
tymon/jwt-auth 0.5.12 requires illuminate/support ~5.0
Publish date: 2022-02-18 | Comments: 2
Laravel Network is unreachable stream_socket_client 587
Publish date: 2022-02-16 | Comments: 4
Uncaught Error: Missing required parameters: sitekey Laravel
Publish date: 2022-01-08 | Comments: 2