Files

29 lines
773 B
PHP
Raw Permalink Normal View History

2024-05-23 16:41:29 +05:30
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
2024-06-07 14:55:50 +05:30
use Illuminate\Support\Facades\Log;
2024-05-23 16:41:29 +05:30
use Symfony\Component\HttpFoundation\Response;
class CheckStatus
{
/**
* Handle an incoming request.
*
* @param \Closure(\Illuminate\Http\Request): (\Symfony\Component\HttpFoundation\Response) $next
*/
public function handle(Request $request, Closure $next): Response
{
$admin = auth()->guard('admin')->user();
2024-07-03 13:38:46 +05:30
// Log::info($admin);
2024-06-07 14:55:50 +05:30
if ($admin && $admin->is_active == 1 && ($admin->principal_type_xid == 1 || $admin->principal_type_xid == 2)) {
2024-05-23 16:41:29 +05:30
return $next($request);
} else {
return redirect('/')->with('error_msg', 'You must be logged in..');
}
}
}