How to set up an application level attribute for API application?
Hi!
As we set up locale at the application level in Laravel.
How can I set up an application-level attribute (like a subdomain or mode)? (Which I am gonna get in each API request) but perhaps I can set it in middleware and can use it anywhere in an application for example Services or Repositories or Models ...
How you determine which locale to serve will depend on how your API user(s) request their locale - is it something that comes in the request via URI segment, or a header; or, does the authenticated user have a locale persisted (in the database for example).
Thanks for responding. I was using localization as an example. I have already implemented localization but that was Laravel inbuilt feature. I want to set up some custom attributes like subdomain or mode.
with perhaps function like setSubdomain instead of setLocale.