Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

How to Sharing Data with all Views ?

Answer Posted / Amit Kumar Gill

To share data across multiple views in Laravel, you can use the 'share' method within the AppServiceProvider. Here is an example:
1. Define a property (e.g., $siteName) in the AppServiceProvider class.
2. Set a default value for the property (if required).
3. Use the 'make' and 'singleton' methods to create and reuse the instance of the provider across all routes/views.

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Do you know what version of laravel do you generally use?

813


Tell us have you used lumen before?

795


What is latest version of laravel?

855


What is current stable version of laravel?

842


How much laravel experience do you have?

800