Laravel - Eloquent Relationships (Query made; Not fetching value) -
i trying database information, , can see query being done, unable come content... have follows:
class vendor extends eloquent { public function spider() { return $this->hasone('spider'); } } class spider extends eloquent { public function report() { return $this->hasmany('report'); } }
so... trying use as:
$vendor = vendor::find(1); $vendor->spider->report->id;
this not giving me result - id not being fetched. however, can tell correct query being made database...
select * `report` `report`.`spider_id` = ?
why not giving me anything? have tried several ways such as... $vendor->spider->first()->report->first()->id
... , on... errors.
thank's.
report of type hasmany collection retrieved. process collection find instance want.
Comments
Post a Comment