trait Illuminate / Database / Eloquent / Concerns / HidesAttributes

HidesAttributes

Properties

protected

$hidden string[]

The attributes that should be hidden for serialization.

Default: []
protected

$visible string[]

The attributes that should be visible in serialization.

Default: []

Methods

public

getHidden ( ) : string[]

Get the hidden attributes for the model.

public

setHidden ( array $hidden ) : $this

Set the hidden attributes for the model.

Parameters

  • $hidden string[]
public

getVisible ( ) : string[]

Get the visible attributes for the model.

public

setVisible ( array $visible ) : $this

Set the visible attributes for the model.

Parameters

  • $visible string[]
public

makeVisible ( $attributes ) : $this

Make the given, typically hidden, attributes visible.

Parameters

  • $attributes string[]|string|null
public

makeVisibleIf ( $condition , $attributes ) : $this

Make the given, typically hidden, attributes visible if the given truth test passes.

Parameters

  • $condition bool|Closure
  • $attributes string[]|string|null
public

makeHidden ( $attributes ) : $this

Make the given, typically visible, attributes hidden.

Parameters

  • $attributes string[]|string|null
public

makeHiddenIf ( $condition , $attributes ) : $this

Make the given, typically visible, attributes hidden if the given truth test passes.

Parameters

  • $condition bool|Closure
  • $attributes string[]|string|null