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

It depends where in the request cycle you want this to be set and where you want this data to be accessed. Most of the times putting it in the boot method of the AppServiceProvider will do, but sometimes it should better be placed in a route middleware (for example if you want to be able to group routes for multilanguage setup).

Last updated 9 years ago.
0

The following SO question has two answers, one with an example using a ServiceProvider and another using a Middleware.

http://stackoverflow.com/questions/28356193/laravel-5-share-variables-in-service-providers

0

Thanks, reading up on it.

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.