interface Illuminate / Contracts / Auth / Access / Gate
You are viewing an older version of the documentation. For the latest, please visit master documentation.

Gate

Methods

public

has ( $ability ) : bool

Determine if a given ability has been defined.

Parameters

  • $ability string
public

define ( $ability , $callback ) : $this

Define a new ability.

Parameters

  • $ability string
  • $callback callable|string
public

resource ( $name , $class , array $abilities ) : $this

Define abilities for a resource.

Parameters

  • $name string
  • $class string
  • $abilities array|null
public

policy ( $class , $policy ) : $this

Define a policy class for a given class type.

Parameters

  • $class string
  • $policy string
public

before ( callable $callback ) : $this

Register a callback to run before all Gate checks.

Parameters

  • $callback callable
public

after ( callable $callback ) : $this

Register a callback to run after all Gate checks.

Parameters

  • $callback callable
public

allows ( $ability , $arguments ) : bool

Determine if the given ability should be granted for the current user.

Parameters

  • $ability string
  • $arguments array|mixed
public

denies ( $ability , $arguments ) : bool

Determine if the given ability should be denied for the current user.

Parameters

  • $ability string
  • $arguments array|mixed
public

check ( $abilities , $arguments ) : bool

Determine if all of the given abilities should be granted for the current user.

Parameters

  • $abilities iterable|string
  • $arguments array|mixed
public

any ( $abilities , $arguments ) : bool

Determine if any one of the given abilities should be granted for the current user.

Parameters

  • $abilities iterable|string
  • $arguments array|mixed
public

authorize ( $ability , $arguments ) : Response

Determine if the given ability should be granted for the current user.

Parameters

  • $ability string
  • $arguments array|mixed
public

inspect ( $ability , $arguments ) : Response

Inspect the user for the given ability.

Parameters

  • $ability string
  • $arguments array|mixed
public

raw ( $ability , $arguments ) : mixed

Get the raw result from the authorization callback.

Parameters

  • $ability string
  • $arguments array|mixed
public

getPolicyFor ( $class ) : mixed

Get a policy instance for a given class.

Parameters

  • $class object|string
public

forUser ( $user ) : static

Get a guard instance for the given user.

Parameters

public

abilities ( ) : array

Get all of the defined abilities.