You're doing it wrong. Your code is inconsistent, that's the reason:
$model = Model::with('someRelation')->first();
// 'someRelation' stored in relations array
$model->some_relation; // new query, new 'some_relation' stored in relations array
// but try camelCased and it will be what you expect
$model->someRelation
Ooohhh, of course! So when I ->toArray(), 'someRelation' (ie camelCases) renames to 'some_relation' (ie underscored).
should have realised. Welp, wont be doing that again. Thanks for your help :D
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community