When your controller interacts with your FooRepository and your FooRepository executes and returns:
$this->model->with('Bar')->get()
you're given Foo models with the related Bar models eager loaded. At this point, you're done with the FooRepository (it's job is done) and are working directly with those 2 models.
I'm not sure what capabilities methodInFooRepo() is supposed to provide, but it sounds like that method should probably be in Foo and not FooRepository. If your view or controller needs to continue to use FooRepository, your controller should already have a reference to that (using the IoC container or through some other way you've instantiated and made that available).
I'm not sure what capabilities methodInFooRepo() is supposed to provide, but it sounds like that method should probably be in Foo and not FooRepository.
Edited the original post with comments at the methods. Do you think this method must be in the Foo model? But i want a clean model file ( only with relations, id name, etc )
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community