I have a Post model, that read from my table "posts".
In my PostController, I inject an PostRepositoryInterface that is bound to an EloquentPostRepository by a service provider.
All works well, but I have a new problem:
For the creation and editing of the post, I don't want to show a form, I want to call an external API that will return some XML then I want to dispatch that information into my database.
I can do each step separately, but I'm not sure how to structure this whole scenario into something that is not a mess.
Where would I put the API-client code? Certainly this has nothing to do with my EloquentRepo, yet it still need to store the data into my database...
My personal solution right now : I have created a PostWebInterface with the implementation VendorPostWeb that I inject in my Post controller along with the classical repository and that I can use for the method like create and update.
I'm not sure it's the best way, but I don't think many developers use laravel as a SOAP client... So nobody can judge me :p
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community