简体   繁体   中英

Heavy database-query page, best practice

I have this task on hand, a page which essentially can be called a Dashboard. It has many blocks of information and all of this information needs to be queried from database.

I'm thinking of best practice approach towards Models when it comes to Laravel. Controllers and Views are simple: one controller, structure of views.

Thing to mentioned, this is a fresh Laravel, no pre-existing Model exists, however database big and is full of records and this page can be called a micro-service - meant to represent the data in a dashboard format.

Should I be doing Eloquent models to map as much as I can and use it inside my Controller to get the data or Query Builder would be better option considering I don't need migration and this Laravel build will never do Writes, only Reads.

Any input from gurus much appreciated.

I recommend you to check Laravel's repositories pattern. This pattern is used when you are working with database (storing, retrieving...). I think it would be perfect to use in your case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM