-
-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
The hidden attributes do not show the attributes where user try to show the model as json format.
It's actually made from the model property like this
class UserModel extens Model
{
/**
* The hidden attributes
*
* @var array
*/
protected array $hidden = [
"created_at",
"updated_at",
];For this cas the hidden attributes should be made programmaticaly.
$user->setHiddenAttributes(["password"]);The short code for implementing the method:
/**
* Set the hidden attributes
*
* @param array $attributes
*/
public function setHiddenAttributes(array $attributes)
{
$this->hidden = array_merge($this->hidden, $attributes);
}