Closed dhcmega closed 4 years ago
I think I could also add this method to be used instead of toArray() for static calls like:
$users = User::find(1)->toArrayWithoutMetas();
/**
* Convert the model instance to an array.
*
* @return array
*/
public static function toArrayWithoutMetas()
{
return parent::toArray();
}
This is another alternative:
$users = User::find(1)->withoutMetas();
/**
* Convert the model instance to an array.
*
*/
public function withoutMetas()
{
$this->hideMeta = true;
return $this;
}
Hi @kodeine This PR adds a conditionl to the method that returns the model as an array for setting if the generated array should or should not include all the metas.
This is my very first PR. Hope I have done it properly
Thanks!