lundi 30 janvier 2017

Custom models for custom query in Laravel

Lets me explain! I have an API with plain php that my app use (returns JSON).

Now I making a web site with Laravel 5.4 to show the same data that the user can see with the mobile app connected with the api.

The problem? I have to make the same logic that I follow in my api (because I need to get the same result). I need to list data but is not directly from one of my table, is from a custom query, then this result of the query I need to do some logic and then create the model that I Want to return to the view.blade.php to loop after all.

Of course, working with Laravel, I don't have to use any api because I'm already on the server side.

It is possible to do what I want? This is an example of my custom model (I put an image from my json of my API, but I need to get the same result with a custom model like I said above) what i gonna have after the query and after make some logic on the query result:

enter image description here



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire