I am creating an API with laravel 5.1.
I have access to 3 sections: user, administrator, super administrator.
I am interested in the practice of handling the controller. Now I am making 3 different controllers for each section. But sometimes I need to call the same function inside the controller. Eg Product:all().
Product:all()
Should I make 3 different controllers or can I use only 2 controllers for best practice?
I would use one controller / one route /api/v1/productswhen the returned dataset is the same for all users (i.e. for the main users, administrators and super admins).
/api/v1/products
, /- . /api/v1/products , , , .
, , admin/super admin, . / API.
Source: https://habr.com/ru/post/1620456/More articles:Изменить размер окна в блоке IPython - pythonRemove duplicate sequence of integers from a list in Python - pythonFunctional programming: Curry & Fold - what are the etymologies? - scalaConfusing JSON API from Ember.js - jsonPython: PyQt4 QtGui ImportError: DLL loading error - pythonember data no models found for attribute name - ember.js"strptime" in SWI-Prolog - prologHow to get the last N entries of each group in mongodb? - node.jsbrilliant filter applied to two outputs - rshell regex: Извлечь цены - regexAll Articles