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

The way to go is $category->parent->name

If you call parent with () the query object will be returned (thats why there is an error) but without it laravel is smart enough to know it should execute the query and associate the resulting model to the parent attribute :)

Last updated 2 years ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lowjarp lowjarp Joined 11 Jul 2014

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.