class RoleMiddleware

Methods

__construct(Factory $auth)

Create a new middleware instance.

handle(Request $request, Closure $next, mixed $role, string|null $guard = null)

Handle an incoming request.

static string
using(array|string|UnitEnum $role, string|null $guard = null)

Specify the role and guard for the middleware.

static string
parseRolesToString(array|string|UnitEnum $role)

Parse the roles into a pipe-delimited string.

Details

at line 23
__construct(Factory $auth)

Create a new middleware instance.

Parameters

Factory $auth

at line 30
Response handle(Request $request, Closure $next, mixed $role, string|null $guard = null)

Handle an incoming request.

Parameters

Request $request
Closure $next
mixed $role
string|null $guard

Return Value

Response

at line 63
static string using(array|string|UnitEnum $role, string|null $guard = null)

Specify the role and guard for the middleware.

Parameters

array|string|UnitEnum $role
string|null $guard

Return Value

string

at line 75
static protected string parseRolesToString(array|string|UnitEnum $role)

Parse the roles into a pipe-delimited string.

Parameters

array|string|UnitEnum $role

Return Value

string