trait GuardsAttributes

Properties

protected array $fillable

The attributes that are mass assignable.

protected array $guarded

The attributes that aren't mass assignable.

static protected bool $unguarded

Indicates if all mass assignment is enabled.

Methods

array
getFillable()

Get the fillable attributes for the model.

$this
fillable(array $fillable)

Set the fillable attributes for the model.

array
getGuarded()

Get the guarded attributes for the model.

$this
guard(array $guarded)

Set the guarded attributes for the model.

static void
unguard(bool $state = true)

Disable all mass assignable restrictions.

static void
reguard()

Enable the mass assignment restrictions.

static bool
isUnguarded()

Determine if current state is "unguarded".

static mixed
unguarded(callable $callback)

Run the given callable while being unguarded.

bool
isFillable(string $key)

Determine if the given attribute may be mass assigned.

bool
isGuarded(string $key)

Determine if the given key is guarded.

bool
totallyGuarded()

Determine if the model is totally guarded.

array
fillableFromArray(array $attributes)

Get the fillable attributes of a given array.

Details

at line 35
array getFillable()

Get the fillable attributes for the model.

Return Value

array

at line 46
$this fillable(array $fillable)

Set the fillable attributes for the model.

Parameters

array $fillable

Return Value

$this

at line 58
array getGuarded()

Get the guarded attributes for the model.

Return Value

array

at line 69
$this guard(array $guarded)

Set the guarded attributes for the model.

Parameters

array $guarded

Return Value

$this

at line 82
static void unguard(bool $state = true)

Disable all mass assignable restrictions.

Parameters

bool $state

Return Value

void

at line 92
static void reguard()

Enable the mass assignment restrictions.

Return Value

void

at line 102
static bool isUnguarded()

Determine if current state is "unguarded".

Return Value

bool

at line 113
static mixed unguarded(callable $callback)

Run the given callable while being unguarded.

Parameters

callable $callback

Return Value

mixed

at line 134
bool isFillable(string $key)

Determine if the given attribute may be mass assigned.

Parameters

string $key

Return Value

bool

at line 164
bool isGuarded(string $key)

Determine if the given key is guarded.

Parameters

string $key

Return Value

bool

at line 174
bool totallyGuarded()

Determine if the model is totally guarded.

Return Value

bool

at line 185
protected array fillableFromArray(array $attributes)

Get the fillable attributes of a given array.

Parameters

array $attributes

Return Value

array