trait Illuminate / Database / Eloquent / Concerns / GuardsAttributes
You are viewing an older version of the documentation. For the latest, please visit master documentation.

GuardsAttributes

Properties

protected

$fillable string[]

The attributes that are mass assignable.

Default: []
protected

$guarded string[]|bool

The attributes that aren't mass assignable.

Default: array
protected static

$unguarded bool

Indicates if all mass assignment is enabled.

Default: false
protected static

$guardableColumns array

The actual columns that exist on the database and can be guarded.

Default: []

Methods

public

getFillable ( ) : array

Get the fillable attributes for the model.

public

fillable ( array $fillable ) : $this

Set the fillable attributes for the model.

Parameters

  • $fillable array
public

mergeFillable ( array $fillable ) : $this

Merge new fillable attributes with existing fillable attributes on the model.

Parameters

  • $fillable array
public

getGuarded ( ) : array

Get the guarded attributes for the model.

public

guard ( array $guarded ) : $this

Set the guarded attributes for the model.

Parameters

  • $guarded array
public

mergeGuarded ( array $guarded ) : $this

Merge new guarded attributes with existing guarded attributes on the model.

Parameters

  • $guarded array
public static

unguard ( $state ) : void

Disable all mass assignable restrictions.

Parameters

  • $state bool
public static

reguard ( ) : void

Enable the mass assignment restrictions.

public static

isUnguarded ( ) : bool

Determine if the current state is "unguarded".

public static

unguarded ( callable $callback ) : mixed

Run the given callable while being unguarded.

Parameters

  • $callback callable
public

isFillable ( $key ) : bool

Determine if the given attribute may be mass assigned.

Parameters

  • $key string
public

isGuarded ( $key ) : bool

Determine if the given key is guarded.

Parameters

  • $key string
protected

isGuardableColumn ( $key ) : bool

Determine if the given column is a valid, guardable column.

Parameters

  • $key string
public

totallyGuarded ( ) : bool

Determine if the model is totally guarded.

protected

fillableFromArray ( array $attributes ) : array

Get the fillable attributes of a given array.

Parameters

  • $attributes array