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

Was just looking for the same thing ;)

Try $this->load('roles') in your function after attaching the new role. This will refresh the roles relationship. Not sure if this is best practice, though, but it works...

Last updated 2 years ago.

It worked for me too, it would be great to know if load() makes another query to the database, I also think it should do that by default.

Thanks Shineability


Thanks, Shineability, that helped... You would indeed expect the relationships to be loaded by default after attaching..


Thanks shineability that worked for me.


Sign in to participate in this thread!


Your banner here too?

brucek2 brucek2 Joined 16 Mar 2014


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

Your logo here?

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

© 2024 - All rights reserved.