user(); if (!$admin) { abort(403); } $hasPermission = $admin->permissions() ->where('name', $permission) ->exists(); if (!$hasPermission) { abort(403, 'شما اجازه دسترسی به این بخش را ندارید.'); } return $next($request); } }