Support the ongoing development of Laravel.io →
posted 9 years ago
Architecture
Last updated 2 years ago.
0

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,

  1. It suits L4 not L5
  2. I could not see a modular structure on it.
0

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').

0

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!

0

Keeping your logic seperate is as simple as PSR4 namespacin your classes & Folders.

Some things you should take care:

  1. 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

  1. 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

Last updated 9 years ago.
0

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.

0

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

0

Sign in to participate in this thread!

Eventy

Your banner here too?

ziyahan ziyahan Joined 2 Mar 2015

Moderators

We'd like to thank these amazing companies for supporting us

Your logo here?

Laravel.io

The Laravel portal for problem solving, knowledge sharing and community building.

© 2024 Laravel.io - All rights reserved.