Laravel: Separate Controllers/Views for Admins/Managers?

preview_player
Показать описание
This is a quick code structure review based on an email I received.

- - - - -
Support the channel by checking out my products:

- - - - -
Other places to follow:
Рекомендации по теме
Комментарии
Автор

I would probably use inheritance for the Controllers, to minimize code duplications, that’s what OOP is all about. I make use of inheritance a lot for all kinds of classes in Laravel, like commands, jobs, formrequests, notifications, tests and so on.

OliverKurmis
Автор

this what i really needed.. and upload 9 hours ago.. amazing timing.. thanks lot

ilhamzulfikar
Автор

I would go on a similar way that the video describes.
If an "Action" on one "Entity" is the same, but what changes is the role of the logged user its probably better to have one controller and use globalscopes, guards and middlewares to not bloat your "Actions" with outside "Conditions".

ThePajeIsHere
Автор

I believe that these controllers will differ from each other in future as long as the project is live, so I would leave them as they are

horrorua_
Автор

Hi Povilas, I hope you get over soon from your sore throat.
What would be your approach for hiding options from the view depending on the type of user? for example Edit or Delete records. Thank for your effort on shooting videos even your voice is a little affected, by the way is clear enough.

augustomoradiaz
Автор

I don't think we can access the authenticated user in the constructor. I had a problem with that in one of my project when I wanted to access auth()->user() in constructor, i was geeting null. Can you please confirm me that or it's was just a bug in my project

LuffyX
Автор

I want to know, what font on sublime text

agungwidada
Автор

Thanks for the video. can you please teach how to connect two projects to a single laravel backend, as in a mobile application(react native) and a website made with a single backend code(laravel).

acegeneral
Автор

Hmmm.... Now that's interesting 🤔

alnahian
Автор

Do you have videos talking about design pattern with laravel ?

ariumboroseno
Автор

Good day Povilas! Why have you decided to change your code editor?

antonmykhailovskyi
Автор

I'm searching for the option play all your videos as a playlist and cannot see it. Also I'm not able to sort by the oldest... A few days ago I was updating my project from laravel 5.4 to laravel 9 and I wan't to catch up what happened in between, I see a lot of new features/libraries etc. Any idea?

tomaszzukowski