Support the ongoing development of Laravel.io →
Database Eloquent
Last updated 2 years ago.
0

Sorry I should have explained clearly... Here is an example:

Models:

class SubIssue extends Eloquent { public function issueTracker() { return $this->belongsTo('App\Models\Issues\IssueTracker', 'issue_tracking_sub_issue_id', 'sub_issue_id'); }

class IssueTracker extends Eloquent { public function subIssue() { return $this->hasOne('App\Models\Issues\SubIssue', 'sub_issue_id', 'issue_tracking_sub_issue_id'); }

Controller:

$data = $issueTracker->where('issue_tracking_user_id', $id) ->with('subIssue') ->get();

In the $data collection I am getting "sub_issue" as array instead of "SubIssue".

Thanks for your time.

0

Sign in to participate in this thread!

Eventy

Your banner here too?

bpattan bpattan Joined 17 Jan 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.