lundi 31 octobre 2016

Best practices to load multiple views for same resource

I'm having a bad time figuring out the best way to load multiple views of the same resource in Laravel. I'll explain the problem:

I have a resource called Books, which has a controller called BooksController with the basic restfull methods (index, store, etc.). Now I want that, in my home page, these books to be loaded with different stuff from different resources, but I also want these books to be loaded with different resources in different pages too, and this is where I'm having trouble finding the controllers I should use.

When should I use the BooksController GET requests, since it will never only show something related to the books only?

Should I create a controller for each page? Like a HomeController to show the books with the different resources, and the same for any other -Page-Controller, leaving the BooksController only for updating and storing?

Maybe I should not use rest at all and just create a controller for each page?

I really need a light here to help me better understand this Pages and Controllers flow using MVC and REST, thanks in advance!

Aucun commentaire:

Enregistrer un commentaire