N
N
NikSIk312020-08-28 01:06:18
Laravel
NikSIk31, 2020-08-28 01:06:18

Laravel controller framework?

I have 3 places where I use task in the URL, these are:
domain.com/task/{id} --- here I need to output
domain.com/cabinet/task/{id} --- output + write to another table BUY
domain.com/admin/task/{id} --- CRUD
and the same with user.
What is the best way to organize controllers in this case? I can create:
1) folders for admin , cabinet, outer controllers and place them in EACH for TaskController , UserController
2) separately AdminController, CabinetController, OuterController and describe all these methods there
3) TaskController, UserController in which all methods will be in the heap for each of the pages. But I feel it will be porridge ..

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Daria Motorina, 2020-08-28
@NikSIk31

The frontend, personal account and admin panel are modules that are different in logic, point 1 is most suitable for independent development of the code. The general logic can always be moved to services / helpers and transferred to controllers via DI

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question