How to check if a user is authenticated in a cookie session in Laravel?

Well, at the moment I have 2 sites.

  • One with laravel (database session driver).
  • Another one with regular php.

The two sites are on the same domain, so we can exchange cookies. But I need a simple way to verify the authenticity of the cookie session on the laravel site.

My idea is to expose a method above the laravel site to call it from another php project, something like this:

public function checkUser($cookie)
{
    return Auth::check($cookie);
}

      

Is there a simple method like Auth :: check ($ cookie)? or what do I need for this?

Thank!

+3


source to share


1 answer


Auth::user()

will return the registered user or FALSE

.



+1


source







All Articles