How to share data with views?

Posted by Andre Scott | Updated on

To pass data to all views in Laravel use method called share(). This method takes two arguments, key, and value.

Generally, share() method are called from boot method of Laravel application service provider. A developer can use any service provider, AppServiceProvider, or our own service provider.


If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.

Related Questions & Answers