I have just started a project that pulls ALL data from an API. From User info for authentication to a list of options for a dropdown. All the tutorials I have found assume a database (actually a fair assumption) which I do not have. I would like to be able to get everything from the API but somehow utilize eloquent and collections. Due to the restrictions, I am having a hard time figuring out how to do this. Even something that eloquent can do fairly easy it appears like $user->hasRole(); isn't easy and there is a call to an API to get a specific user (can't user $user->where ) then I have to make an additional call to the API to get all of the user roles or a specific one.
Does anyone know of any tutorials or sites that would help me try to use this API as I would a database? Someone suggested a repository pattern but as I have only been using Laravel (and PHP for that matter) a few months it isn't coming easy to me. I am happy to watch a video over and over until is syncs in but I can't even find one. Any suggestions are very appreciated.
I am confused about why this link was sent? I was not inquiring anything to so with a session or session state. Nor do I have a choice to not use an API instead of a database.
My question is how to implement a site using an API AS the database and if using a repository pattern would help accomplish this.
As for the session state, I can cache the user object in the app during a session and not need to return to authenticate the user once they are logged in.
Personally I don't see what a repository would have to do when you consume API data. But I suppose some people do use a repository.
Step one would be getting the data and looping through or convert it to a collection to work with.
On the other hand it depends on how much data. I can see a few to several hundred records in a collection, but not tens of thousands.
Likewise what type of data are you working with makes a difference.
For example a simple Json array would be easy to deal with, but if it's something that's deeply nested then converting to a collection can be a challenge.
I have worked with apis, but not like this. in my case there was still a database and I sent data to them.
Wondering if you ever came up with anything? I didn't have trouble with authentication and a custom user provider, but password reset without a database is proving to be a b*tch using Laravel's scaffolding.