GuardsAttributes
Table of Contents
- $fillable : array<string|int, mixed>
- The attributes that are mass assignable.
- $guardableColumns : array<string|int, mixed>
- The actual columns that exist on the database and can be guarded.
- $guarded : array<string|int, mixed>
- The attributes that aren't mass assignable.
- $unguarded : bool
- Indicates if all mass assignment is enabled.
- fillable() : $this
- Set the fillable attributes for the model.
- getFillable() : array<string|int, mixed>
- Get the fillable attributes for the model.
- getGuarded() : array<string|int, mixed>
- Get the guarded attributes for the model.
- guard() : $this
- Set the guarded attributes for the model.
- isFillable() : bool
- Determine if the given attribute may be mass assigned.
- isGuarded() : bool
- Determine if the given key is guarded.
- isUnguarded() : bool
- Determine if current state is "unguarded".
- reguard() : void
- Enable the mass assignment restrictions.
- totallyGuarded() : bool
- Determine if the model is totally guarded.
- unguard() : void
- Disable all mass assignable restrictions.
- unguarded() : mixed
- Run the given callable while being unguarded.
- fillableFromArray() : array<string|int, mixed>
- Get the fillable attributes of a given array.
- isGuardableColumn() : bool
- Determine if the given column is a valid, guardable column.
Properties
$fillable
The attributes that are mass assignable.
protected
array<string|int, mixed>
$fillable
= []
$guardableColumns
The actual columns that exist on the database and can be guarded.
protected
static array<string|int, mixed>
$guardableColumns
= []
$guarded
The attributes that aren't mass assignable.
protected
array<string|int, mixed>
$guarded
= ['*']
$unguarded
Indicates if all mass assignment is enabled.
protected
static bool
$unguarded
= false
Methods
fillable()
Set the fillable attributes for the model.
public
fillable(array<string|int, mixed> $fillable) : $this
Parameters
- $fillable : array<string|int, mixed>
Return values
$this —getFillable()
Get the fillable attributes for the model.
public
getFillable() : array<string|int, mixed>
Return values
array<string|int, mixed> —getGuarded()
Get the guarded attributes for the model.
public
getGuarded() : array<string|int, mixed>
Return values
array<string|int, mixed> —guard()
Set the guarded attributes for the model.
public
guard(array<string|int, mixed> $guarded) : $this
Parameters
- $guarded : array<string|int, mixed>
Return values
$this —isFillable()
Determine if the given attribute may be mass assigned.
public
isFillable(string $key) : bool
Parameters
- $key : string
Return values
bool —isGuarded()
Determine if the given key is guarded.
public
isGuarded(string $key) : bool
Parameters
- $key : string
Return values
bool —isUnguarded()
Determine if current state is "unguarded".
public
static isUnguarded() : bool
Return values
bool —reguard()
Enable the mass assignment restrictions.
public
static reguard() : void
Return values
void —totallyGuarded()
Determine if the model is totally guarded.
public
totallyGuarded() : bool
Return values
bool —unguard()
Disable all mass assignable restrictions.
public
static unguard([bool $state = true ]) : void
Parameters
- $state : bool = true
Return values
void —unguarded()
Run the given callable while being unguarded.
public
static unguarded(callable $callback) : mixed
Parameters
- $callback : callable
Return values
mixed —fillableFromArray()
Get the fillable attributes of a given array.
protected
fillableFromArray(array<string|int, mixed> $attributes) : array<string|int, mixed>
Parameters
- $attributes : array<string|int, mixed>
Return values
array<string|int, mixed> —isGuardableColumn()
Determine if the given column is a valid, guardable column.
protected
isGuardableColumn(string $key) : bool
Parameters
- $key : string