我想将我的应用程序分成模块.例如,会有一个"核心"模块,其中包含基本登录功能,应用程序布局/格式(CSS等),用户管理和日记.
稍后我可以创建其他模块,如联系人管理器,可以轻松地从应用程序中添加或删除.
应用程序导航中会有一些逻辑用于确定存在哪些模块以及显示/隐藏指向它们的链接.
我如何在目录结构,命名空间和其他任何需要的方面做到这一点?
我正在看creolab/laravel-modules,但是它说它适用于Laravel 4.我还能以完全相同的方式使用它吗?
文档说在每个模块目录中放置模型,控制器和视图,但这如何与路由一起使用?理想情况下,我希望每个模块都有自己的routes.php文件.如何将所有的东西这项工作http和resources目录?
我在考虑这样的事情:

但我不知道如何让它发挥作用.
我刚刚在这里尝试了教程:
http://creolab.hr/2013/05/modules-in-laravel-4/
没有额外的库等,只需要纯粹的Laravel 5.
我似乎碰到了一堵砖墙,上面写着错误信息:
FatalErrorException in ServiceProvider.php line 16:
Call to undefined method Illuminate\Config\Repository::package()
Run Code Online (Sandbox Code Playgroud)
关于以下内容:
<?php namespace App\Modules;
abstract class ServiceProvider extends \Illuminate\Support\ServiceProvider
{
public function boot()
{
if ($module = $this->getModule(func_get_args())) {
$this->package('app/' . $module, $module, app_path() . '/modules/' . $module);
}
}
public function register()
{
if ($module = $this->getModule(func_get_args())) {
$this->app['config']->package('app/' . $module, app_path() . '/modules/' . $module . '/config');
// Add routes …Run Code Online (Sandbox Code Playgroud) 加载路由 /users 或 /user/add 时出现问题并返回错误;
Route.php 第 280 行中的 ReflectionException:Class App\Http\Controllers\App\Controllers\UserController 不存在
UserController 确实存在,但它不在我的控制器文件夹中的文件夹中。
我的路由文件;
Route::group(['middleware' => 'auth'], function(){
Route::get('/route/selector', 'PagesController@selectRoute');
// Admin Only //
Route::group(['middleware' => 'isAdmin'], function(){
Route::get('/admin', 'AdminController@index');
Route::get('/users', 'UserController@index');
Route::get('/user/add', 'UserController@getAdd');
Route::post('/user/add', 'UserController@postAdd');
Route::get('/user/edit/{id}', 'UserController@getEdit');
Route::post('/user/edit/{id}', 'UserController@postEdit');
Route::get('/user/delete/{id}', 'UserController@delete');
});
});
Run Code Online (Sandbox Code Playgroud)
我的用户控制器;
<?php
namespace App\Http\Controllers;
use App\Http\Requests;
use App\User;
use App\UserTypes;
use Auth;
use Hashids;
use Redirect;
use Request;
use Hash;
class UserController extends Controller
{
public function index(){
$users = User::get();
return view('users.index', compact('users'));
} …Run Code Online (Sandbox Code Playgroud)