Answer the question
In order to leave comments, you need to log in
What is the best pattern to use to implement getting data from multiple sources (depending on the selected flag)?
Good afternoon.
The task is extremely simple: there is an application on Laravel. This application has an entity, let's say Event (in fact, there are many of these entities in a real application). And each of these entities can receive data from one of several sources (the range of these sources can be limited by the unlimited imagination of the customer). Right now I am forced to get data from the database and from the external API, depending on the flag key that is present in the database for a particular Date entity. If a simple Eloquent can be retrieved from the database, then as a result these models turn out to be impossible to use with an external data source, and it is necessary to use a number of functional from them, for example, the paginate(), all(), get() methods, and so on.
One or more templates should be used so that it is easy to add both new entities and new places to get data (for example, the issue of getting data from a CSV file is currently being discussed).
I would be grateful if you poke your nose at the desired pattern and options for its implementation, so that I can understand the topic a little.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question