mardi 28 mars 2017

How can I organize the content of my controllers in Laravel if i have reports?

I'm creating a Laravel app and I have controllers with the CRUD methods, but I need to show reports and I'm not sure if I have to create a controller called 'Reports' or I have to put each report function inside the controller:

  1. First Option:

    • Controllers/ProductController.php
      • Functions (Create, Read, Edit, Update, Delete)
    • Controllers/CategoryController.php
      • Functions (Create, Read, Edit, Update, Delete)
    • Controllers/ReportController.php
      • Functions (TopProducts, TopCategories)
  2. Second Option:

    • Controllers/ProductController.php
      • Functions (Create, Read, Edit, Update, Delete, TopProducts)
    • Controllers/CategoryController.php
      • Functions (Create, Read, Edit, Update, Delete, TopCategories)

I hope you can tell me a which is the best option or your own alternative. Thanks.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire