Support the ongoing development of Laravel.io →
Database Eloquent

I am confused with naming conventions for methods in model relationships.. If I use Camel case, the name of the array in query results is not standard.

Example: Method name: testFunc ---> Query array has sometimes TestFunc and other times Test_func.

Can somebody please shed some light on this? How the array name is formulated?

Thanks for your time.

Last updated 3 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!

PHPverse

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.

© 2025 Laravel.io - All rights reserved.