Hello everyone,
I've fallen down the rabbit whole and am really hoping for some sanity checking from whoever has opinions on this.
I'm using Entrust to implement user roles. I am not currently using the permissions piece, just three different roles. Thinking I was cool, I added an event to postLogin that set's a Session variable called 'myRole' to the appropriate Role for that user (either 'customer', 'tech', or 'admin').
I see so many different ways of handling this. I'm trying not to make a complete mess of this project. Options, as I see them right now:
-
Create separate routes for each role, like "Route::get('customers/tickets')..." "Route::get('techs/tickets')...". Have those point to individual controllers, like "CustomersController", "TechsController". Have those return separate views so I end up with views directories like "customers", "techs", etc.
-
Keep sensible, "normal" routes like "Route::resource('tickets', 'TicketsController'); and let my controller disstinguish between roles, fill variable names that are the same for each role so that I can pass it all on to a single view structure.
Or a mix of those. I am using model scopes to get the appropriate data from the database which seems to be adding an added layer of organization complexity.
Right now I kind of have a mix of all this going on and things are getting a little out of control, disjointed, and definitely less and less scalable as I go. Just looking for opinions on good ways to handle user roles without making a complete mess out of things.
How do you approach this? What has worked well for you? What has been a disaster?
Thanks in advance for any thoughts!!!!