mercredi 28 octobre 2015

Relationship Has Many Through without firstKey

is there anyway to get result from hasManythrough relationship without the firstKey?

Right now my result is:

 return $this->hasManyThrough('App\Facility', 'App\MerchantBranchFacility', 'id,'facility_id')->select('name');

    {"facilities":[{"name":"AC","id":"13"},{"name":"Wi-Fi","id":"13"}}}

I realize that inside hasmanythrough method laravel always do this:

  return array_merge($columns, [$this->parent->getTable().'.'.$this->firstKey]);

How can i remove "id" without foreach?



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire