Check if admin is already logged in and question about session
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
-
- Posts: 44
- Joined: 24 Jun 2019, 14:46
Check if admin is already logged in and question about session
Hi,
I'm creating a global middleware and I need to know if an admin user is logged in or not.
I tried
but it always return false.
How do you store the session? How can I retrieve the data of the admin user and the session?
I'm using php 7.3, aimeos 2019.07.02 and laravel 5.8.
Thanks
I'm creating a global middleware and I need to know if an admin user is logged in or not.
I tried
Code: Select all
Auth::check()
How do you store the session? How can I retrieve the data of the admin user and the session?
I'm using php 7.3, aimeos 2019.07.02 and laravel 5.8.
Thanks
Re: Check if admin is already logged in and question about session
Aimeos uses the Laravel "users" table so Auth::check() should work. Also, Aimeos uses the Laravel session so you can use it like in every other Laravel application.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
-
- Posts: 44
- Joined: 24 Jun 2019, 14:46
Re: Check if admin is already logged in and question about session
I was creating the wrong type of middleware because I was trying to get the user before the response of the login.
I had to create a middleware like this one:
I had to create a middleware like this one:
Code: Select all
public function handle($request, Closure $next)
{
$response = $next($request);
// Perform action
return $response;
}