GuardsAttributes (Database\Eloquent\Concerns)

GuardsAttributes

trait GuardsAttributes (View source)

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.

Details

array getFillable()

Get the fillable attributes for the model.

Return Value

array

$this fillable(array $fillable)

Set the fillable attributes for the model.

Parameters

array $fillable

Return Value

$this

array getGuarded()

Get the guarded attributes for the model.

Return Value

array

$this guard(array $guarded)

Set the guarded attributes for the model.

Parameters

array $guarded

Return Value

$this

static void unguard(bool $state = true)

Disable all mass assignable restrictions.

Parameters

bool $state

Return Value

void

static void reguard()

Enable the mass assignment restrictions.

Return Value

void

static bool isUnguarded()

Determine if current state is "unguarded".

Return Value

bool

static mixed unguarded(callable $callback)

Run the given callable while being unguarded.

Parameters

callable $callback

Return Value

mixed

bool isFillable(string $key)

Determine if the given attribute may be mass assigned.

Parameters

string $key

Return Value

bool

bool isGuarded(string $key)

Determine if the given key is guarded.

Parameters

string $key

Return Value

bool

bool totallyGuarded()

Determine if the model is totally guarded.

Return Value

bool

© Taylor Otwell
Licensed under the MIT License.
Laravel is a trademark of Taylor Otwell.
https://laravel.com/api/5.4/Illuminate/Database/Eloquent/Concerns/GuardsAttributes.html

在线笔记
App下载
App下载

扫描二维码

下载编程狮App

公众号
微信公众号

编程狮公众号

意见反馈
返回顶部