I have to access some global data, for example session('company_id') which is the company for which the user wants to connect to the app (a user can work for several companies using the same app).
Is it possible to access easily these global data : company_id, company, ... from global functions accessible anywhere in the code ?
function getCurrentCompany()
{
}
function getCurrentCompanyId()
{
}
And other needs like knowing for example if the connected user is admin or only trainer for the current company.
function isAdmin($company_id)
{
}
Creating a new helper could be a solution ? Or a service ?
@vincent15000 In your case I think it's fine to stick to helper functions. I often work with some dependencies and using service classes makes it a lot easier. Plus it can be helpful splitting code across multiple classes if a lot of functions are needed.