Support the ongoing development of Laravel.io →
Requests Session Database
Last updated 2 years ago.
0

It sounds like you want to use a View Composer.

Here's the official documentation on them

Here's a link to an example on Laracast's Forum

Hope this helps!

0

In 5.1 version you can also resolve a service directly from Blade: https://laravel-news.com/2015/04/laravel-5-1/ (see section "Resolve a service from blade")

0

thank you for your replies, it seems that i've to read a lot to understand everything ! cuz still new. Thanks again for your efforts.

0

i solved it using View Composer as you told me, but i've another question if possible :$ now this method is for passing variables to all views or some, is there such a thing but for classes , or Controllers ? so i don't have to include and fetch in each controller.

Thanx a lot

0

My first thought is having a "Base" or "App" controller, and then having your controllers you want to have the classes/included extend the Base/App controller. Laravel has one that you could build upon (the example there is for Laravel 5) or you can make your own.

If I'm misunderstanding, please let me know.

Last updated 9 years ago.
0

well i think this might help, i will try it :) thnx a lot

0

You're welcome!

0

Sign in to participate in this thread!

Eventy

Your banner here too?

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.