Gouvi said:
This video helped me: https://laracasts.com/lessons/users-and-roles
Thanks brother, however I cannot understand what you mean with this example. Because,
It's mainly the concept, I implemented this with L5 with no problem. You can still setup an Admin controller and a Client controller. You can then inject a Request handler in each controller to check if the Auth::user()->hasRole('admin') or if the Auth::user()->hasRole('client').
I haven't used this package yet, but looks like it would be a good starting point for what you'd like to do: https://github.com/caffeinated/modules
Just remember you can customize the folder structure of L5 however you want to without having to do anything too involved. If you want to change the views location you can do that inside the config file. Or if you want to put your controllers in say App/Admin/Controllers, just create the directory put your controllers in there, and then just reference the namespace in your routes (using route groups make this less tedious). I hope this points you in the right direction!
Keeping your logic seperate is as simple as PSR4 namespacin your classes & Folders.
Some things you should take care:
If you change your controllers namespace you must adjust the setting in RouteServiceProvider.php:
protected $namespace = 'App\Http\Controllers';
OR altenative leave it blank and use the full class name of your controller in your routes file
To move your default views folder edit config\views.php
and add your paths. This is the default settings
'paths' => [
realpath(base_path('resources/views'))
],
You could also try a package I've created that will help you to keep your views & assets seperated: igaster/laravel-theme
Hi everyone; I solved this problem using a few tricks which I explained at my blog : http://ziyahanalbeniz.blogspot.com.tr/2015/03/modular-structure-in-laravel-5.html
Thanks everyone.
doktoresperanto said:
Hi everyone; I solved this problem using a few tricks which I explained at my blog : http://ziyahanalbeniz.blogspot.com.tr/2015/03/modular-structure-in-laravel-5.html
Thanks everyone.
looks good
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community