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.
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?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community