PHP Class Spatie\Authorize\Middleware\Authorize

Afficher le fichier Open project: spatie/laravel-authorize

Méthodes publiques

Méthode Description
handle ( Illuminate\Http\Request $request, Closure $next, string | null $ability = null, string | null $boundModelName = null ) : mixed Handle an incoming request.

Méthodes protégées

Méthode Description
getModelFromRequest ( mixed $request, string $boundModelName ) : Model | null Get the model from the request using given boundModelName.
handleUnauthorizedRequest ( $request, string | null $ability = null, Model | null $model = null ) : Illuminate\Contracts\Routing\ResponseFactory | Illuminate\Http\RedirectResponse | Response Handle the unauthorized request.
hasRequiredAbility ( $user, string | null $ability = null, Model | null $model = null ) : boolean Determine if the currently logged in use has the given ability.

Method Details

getModelFromRequest() protected méthode

Get the model from the request using given boundModelName.
protected getModelFromRequest ( mixed $request, string $boundModelName ) : Model | null
$request mixed
$boundModelName string
Résultat Illuminate\Database\Eloquent\Model | null

handle() public méthode

Handle an incoming request.
public handle ( Illuminate\Http\Request $request, Closure $next, string | null $ability = null, string | null $boundModelName = null ) : mixed
$request Illuminate\Http\Request
$next Closure
$ability string | null
$boundModelName string | null
Résultat mixed

handleUnauthorizedRequest() protected méthode

Handle the unauthorized request.
protected handleUnauthorizedRequest ( $request, string | null $ability = null, Model | null $model = null ) : Illuminate\Contracts\Routing\ResponseFactory | Illuminate\Http\RedirectResponse | Response
$request
$ability string | null
$model Illuminate\Database\Eloquent\Model | null
Résultat Illuminate\Contracts\Routing\ResponseFactory | Illuminate\Http\RedirectResponse | Symfony\Component\HttpFoundation\Response

hasRequiredAbility() protected méthode

Determine if the currently logged in use has the given ability.
protected hasRequiredAbility ( $user, string | null $ability = null, Model | null $model = null ) : boolean
$user
$ability string | null
$model Illuminate\Database\Eloquent\Model | null
Résultat boolean