FleetCart/Modules/Core/Http/Middleware/GuestMiddleware.php

28 lines
609 B
PHP
Raw Normal View History

2023-06-11 12:14:03 +00:00
<?php
namespace Modules\Core\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
class GuestMiddleware
{
/**
* Handle an incoming request.
*
* @param \Illuminate\Http\Request $request
* @param \Closure $next
* @return \Illuminate\Http\Response
*/
public function handle(Request $request, Closure $next)
{
if (auth()->check()) {
$route = app('inAdminPanel') ? 'admin.dashboard.index' : 'account.dashboard.index';
return redirect()->route($route);
}
return $next($request);
}
}