Laravel - Serialization - Temporarily Modifying Attribute Visibility

If you would like to make some typically hidden attributes visible on a given model instance, you may use the makeVisible method. The makeVisible method returns the model instance:

    
    return $user->makeVisible('attribute')->toArray();
	

Likewise, if you would like to hide some attributes that are typically visible, you may use the makeHidden method.

    
    return $user->makeHidden('attribute')->toArray();