How to pass parameter to custom middleware?

->authMiddleware([
Authenticate::class,
CheckRole::class,
]);
->authMiddleware([
Authenticate::class,
CheckRole::class,
]);
How do i pass parameter to CheckRole::class in AdminPanelProvider filamentphp?
public function handle(Request $request, Closure $next, Role $requiredRole): Response
{
$userRole = $request->user()->role;

if ($userRole !== $requiredRole) {
$selfPanelRoute = Filament::getPanel($userRole->value)->getId();

return redirect($selfPanelRoute);
}

return $next($request);
}
public function handle(Request $request, Closure $next, Role $requiredRole): Response
{
$userRole = $request->user()->role;

if ($userRole !== $requiredRole) {
$selfPanelRoute = Filament::getPanel($userRole->value)->getId();

return redirect($selfPanelRoute);
}

return $next($request);
}
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server