Reputation: 29
I want to create module with number of controller like
Admin is Module name and have AdminController. Admin module has another controller CategoryController, ProductController. Now i wanted to use that controller as part of admin module How can i achive that using Artem-Schander/L5Modular
Upvotes: 0
Views: 1036
Reputation: 3421
You have the wrong namespace in your CategoryController.php
It should be namespace App\Modules\Admin\Controllers
and not namespace App\Modules\Admin\Controllers\Category
working example:
routes.php:
Route::group(array('module' => 'Admin', 'namespace' => 'App\Modules\Admin\Controllers'), function() {
Route::resource('admin', 'AdminController');
Route::resource('category', 'CategoryController');
});
AdminController.php:
<?php namespace App\Modules\Admin\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use App\Modules\Admin\Models\Admin;
class AdminController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
die('admin controller');
}
}
CategoryController.php:
<?php namespace App\Modules\Admin\Controllers;
use App\Http\Requests;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
//use App\Modules\Admin\Models\Admin;
class CategoryController extends Controller {
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
die('category controller');
}
}
Here you said, you have a blank page. Check your .env file for the debug option and set it to true. Than you should have a detailed debug output.
Upvotes: 1