How to assign a variable value for all view file?



How to assign a variable value for all view file?..

Answer / Sunny Verma

To assign a variable value that will be available across all your views, you can use the global $data array in Laravel. Here is an example: $data['myVar'] = 'someValue'; return view('yourView', $data);

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Laravel PHP Framework Interview Questions

How many types of middleware are there in laravel?

1 Answers  


What are the software’s included in laravel homestead?

1 Answers  


What do you mean by boot & register method used in laravel 5?

1 Answers  


What are all the different Route Parameters ?

1 Answers  


What is the difference between {{ $username }} and {!! $Username !!} In laravel?

1 Answers  


What is redis?

1 Answers  


What is meant by Laravel - Hashing ?

2 Answers  


What is meant by Laravel - Ajax ?

2 Answers  


Who are Manually Authenticating Users in Laravel ?

2 Answers  


What is with() in laravel?

1 Answers  


What is Laravel - Middleware ?

2 Answers  


How to serve sites with tls on valet?

1 Answers  


Categories