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:

objectmodel that have doors, windows, seats, month, year, dayOfWeek, date and apartmodel that have id, part name, object id andthingmodel with name, state, part id something like that. by itself, ORM will map objects that related to each other -- well, i want to say, one-to-many relation will end up the one part hold a collection of the many part. also, don't loop json in blade, usetoJson()if possible.$result = DB::table('table')->get();Pass to the viewreturn view('view', compact('result'));. In the view get them in a loop same as modelsforeach($result as $res){ $res->attribute; }