Policy<T extends Object> class
abstract
Groups authorization logic for one model type (Laravel Policy).
Methods default to deny; override the ones you need and add custom abilities through extra.
Constructors
- Policy()
-
Policies are usually const.
const
Properties
-
extra
→ Map<
String, GateCallback> -
Non-standard abilities keyed by name.
no setter
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
before(
Authenticatable? user, String ability) → FutureOr< Object?> -
Runs before every ability; return
true/false/AuthResponse to short-circuit ornullto continue. -
create(
Authenticatable? user) → FutureOr< Object?> -
Whether
usermay create models. -
delete(
Authenticatable? user, T model) → FutureOr< Object?> -
Whether
usermay deletemodel. -
dispatch(
Authenticatable? user, String ability, List< Object?> args) → FutureOr<Object?> -
Dispatches
abilityto the matching method.argsstarts with the model (or is empty forviewAny/create). -
forceDelete(
Authenticatable? user, T model) → FutureOr< Object?> -
Whether
usermay deletemodelfor good. -
handles(
String ability) → bool -
Whether the policy handles
ability. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
restore(
Authenticatable? user, T model) → FutureOr< Object?> -
Whether
usermay restore the soft deletedmodel. -
toString(
) → String -
A string representation of this object.
inherited
-
update(
Authenticatable? user, T model) → FutureOr< Object?> -
Whether
usermay updatemodel. -
view(
Authenticatable? user, T model) → FutureOr< Object?> -
Whether
usermay viewmodel. -
viewAny(
Authenticatable? user) → FutureOr< Object?> -
Whether
usermay list models (viewAny).
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited