Using Laravel 4.2 & MySQL.
I have an
applications table with an
id and a
fit_score_id column, and a
fit_scores table with an
id column. It's a basic "belongs to" relationship.
The following code:
$query = Application::join('fit_scores', 'applications.fit_score_id', '=', 'fit_scores.id'); $collection = $query->get();
...produces a collection of
Application models with the
id property set to the value of the
fit_score_id. What am I doing to cause this?
I should note that it is necessary to do this join rather than simply using eloquent relations, because I'm going to want to order the results by a column on the
fit_scores table. I don't believe this is possible using Eloquent without an explicit join.