Welcome Guest, Not a member yet? Register   Sign In
Basecontroller load helpers / library depend on loggedin
#1

(This post was last modified: 12-29-2024, 10:18 PM by 4usol.)

Hi,

i want to load different helper in case of a user is logged in (shield) or not.

For this i try to do it like this in my basecontroller:
Code:
if( auth()->loggedIn() )

        // Load helpers for logged-in users
        protected $helpers = ['helper1','helper2',...];
}
else
{
        protected $helpers = ['helper1'];
}

Result: "syntax error, unexpected identifier "auth", expecting "function" or "const""

It seems auth is not avivable at this part/moment?

Is there a way to do what i want - maybe also in the autoload-file?

Also i need to include a own library only if a user is logged in, if i have to do it in another way please let me know whats the difference to do it too.

Thanks to help and understanding ;-)
Reply


Messages In This Thread
Basecontroller load helpers / library depend on loggedin - by 4usol - 12-29-2024, 09:47 PM



Theme © iAndrew 2016 - Forum software by © MyBB