I have two data tables related each other by belongstomany relationship. And when I am fetching data from its api controllers with selecting only two column keys ['id','title'] yet it returns some extra data in response object.
model code:
public function place(){
return $this->belongsToMany(Place::class,'city_place')->select(array('id', 'title'));
}
controller code:
public function ofcity($id) {
$city=City::findOrFail($id);
return new CityResource( $city->place()->get());
}
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2BmcUSd
via IFTTT
Aucun commentaire:
Enregistrer un commentaire