mercredi 22 février 2017

Laravel Model with and makeHidden

I'm pulling data on related models into an array. The makeHidden function works well on the Model, however the related model is unaffected.

    public function show($user)
{
    $model = new User();
    $hidden = $model->allHiddenApiFieldsTemplate();
    $return = $model->with('accounts')->findOrFail($user)->makeHidden(['deleted_at',created_at','updated_at'])->toArray();
    return $return;
}

Is it possible to hide fields on the related entity using makeHidden? Or another way?



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2mbmrCC
via IFTTT

Aucun commentaire:

Enregistrer un commentaire