php - Laravel multiple many to many relationships? -
so using laravel , running issue, have relational model adsale, have setup hasone relationship adimpressions. example grab adsale records userid = 1. 5 different rows back, each of 5 rows have 5 adimpression rows match , have info clicks , impressions. end goal adimpression rows. when run has 1 impressions() method undefined method. if foreach on adsale records individually , run impresssions() method works. here code class adsale extends eloquent{ protected $table = 'adsale'; public function impressions() { return $this->hasone('adimpression','adsaleid','id'); } } here connecting adsale respective adimpression via adsaleid in adimpression table. this running in controller. $sales= adsale::where('userid','=', 1)->get(); $impressions = $sales->impressions(); now expect $impressions variable have adimpressions entry correlates adsaleid, getting undefined function since there multiple val...