abstract class Entity extends Fluent

Abstract class Entity

Properties

protected array $original The entity attribute's original state.
protected array $hidden The attributes that should be hidden for arrays.
protected array $fillable The attributes that are mass assignable.
protected array $guarded The attributes that aren't mass assignable.
bool $exists Indicates if the entity exists.

Methods

__construct(array $attributes = array())

Constructor

$this
syncOriginal()

Sync the original attributes with the current.

array
getOriginal(string|null $key = null, mixed $default = null)

Get the entity's original attribute values.

$this
fill(array $attributes)

Fill the model with an array of attributes.

bool
isFillable(string $key)

Determine if the given attribute may be mass assigned.

bool
isGuarded(string $key)

Determine if the given key is guarded.

array
getDirty()

Get the attributes that have been changed since last sync.

array
toArray()

Convert the entity instance to an array.

Details

at line 72
__construct(array $attributes = array())

Constructor

Parameters

array $attributes attributes

at line 84
$this syncOriginal()

Sync the original attributes with the current.

Return Value

$this

at line 98
array getOriginal(string|null $key = null, mixed $default = null)

Get the entity's original attribute values.

Parameters

string|null $key key name
mixed $default default value when not exists

Return Value

array

at line 109
$this fill(array $attributes)

Fill the model with an array of attributes.

Parameters

array $attributes attributes

Return Value

$this

at line 126
bool isFillable(string $key)

Determine if the given attribute may be mass assigned.

Parameters

string $key key name

Return Value

bool

at line 145
bool isGuarded(string $key)

Determine if the given key is guarded.

Parameters

string $key key name

Return Value

bool

at line 155
array getDirty()

Get the attributes that have been changed since last sync.

Return Value

array

at line 165
array toArray()

Convert the entity instance to an array.

Return Value

array