Laravel - 将多个模型组合到一个数组中

a few years ago I wrote a PHP web application in a rather procedural way. As this project now gets reactivated and expanded I've made the decision to recode it using Laravel with its MVC structure. As I'm new to Laravel and MVC in general I'm working on converting my procedural approach in an object oriented approach.

After creating Models for each database table I'm faced with several questions:

  1. When a page should be loaded that contains data from multiple models what is the best approach? Just call both models, get the data of both Models and send it to the view?

  2. When I want to create a view that contains the aggregated data of multiple tables. In the actual version I just created a class that gets the data from both tables, adds some logic and returns the new array to the view. How would this be implemented in laravel? I didn't find some sort of wrapping model. Can you give me a hint how to implement this in laravel?

Thanks in advance for your help.

I would implement an Repository pattern for your problem. Take a look at my Repositories.

https://github.com/avored/ecommerce/tree/master/src/Models/Repository

At this stage my Repository doesn't contain multi table record fetch or store but eventually i will do it. Just for a starting point of view i hope it helps.