Laravel framework is magnificent framework in todays. Laravel give sevaral great component and that is the reason it is exceptionally well known framework in PHP. Essentially in the event that we are work on huge site venture or ERP level undertaking we generally need to characterize some worldwide variable like site title, number of pagination, footer text and so forth as rely upon our task. Along these lines, I am demonstrating how to characterize and utilize worldwide variable in Laravel 5. Laravel 5 give exceptionally straightforward approach to set Global Variables in our laravel application. It is exceptionally beautiful straightforward and with great index structure.
First we need to make global.php record in config envelope of your laravel 5 application. I added three variable in that document : siteTitle, pagination and tagLine. you can likewise include all the more then one that document. In this model you can get to that factor in entire application, I mean you can get worldwide variable worth on regulator, view, model and anyplace. so duplicate howl code and put in global.php document
return [ 'siteTitle' => 'HD Site', 'pagination' => 5, 'tagLine' => 'Do the best' ];
Read Also : How to convert Object into Array in PHP?
Thanks for read. I hope it help you. For more you can follow us on facebook.