Love Fuel?    Donate

FuelPHP Forums

Ask your question about FuelPHP in the appropriate forum, or help others by answering their questions.
How to check user whether they logged in or not at each page?
  • Hi, I have already created a simple login and register system by using simpleauth, but I did not manage to check whether a user logged in or not? Where should I put before() method, which consists Auth::check() to check it before each page loaded. 

    I think there is controller which is shared controller, but I did not figure out how it works? Thanks in advance.
  • HarroHarro
    Accepted Answer
    if (\Auth::check())
        echo "User is logged in";

    Your controller should extend one of the base controllers, but at least \Controller. before() is just another method, so if you want to check in there, add it to your controller.
  • Thanks for reply Harro. It became more clear.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion