Support the ongoing development of Laravel.io →
posted 9 years ago
Eloquent
Last updated 1 year ago.
0

I'd probaby code this in the controller and not force the Model to deal with it. This way you would have a lot more flexibility and not FORCE activities on the Model to act in such a rigid way.

You could either create another relationship on the Model on 'taught_by_id' or run the query in the Controller/Repo.

My gut would be to run the query off the model so you have a lot more flexibility and would be more future proof really.

It might be right for you, but it is what I would do. Hope it helps.

Last updated 1 year ago.
0

Yeah I could code it into the controller but I make this call so many times I'm going to be repeating the code an awful lot.

I was hoping to simply modify the existing relationship since this would work with my existing code but I could maybe just create a new function in the User model which returns the required activities.

Any other thoughts?

Last updated 1 year ago.
0

Sign in to participate in this thread!

Eventy

Your banner here too?

lainga9 lainga9 Joined 12 Feb 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.