I am trying to separate Backend and Frontend in my project. I have Created two direcotry inside Controllers, named: frondend and backend. I have UsersController inside backend directory. I have added route for UsersController
Route::group(array('prefix' => 'backend'), function() { Route::get('users', array('as' => 'users', 'uses' => 'backend/UsersController@index')); });
I have used namespace as
namespace Controllers/backend;
in my UsersController. I run the command php artisan dump-autoload
. When I try to access the routes as codefacet.loc/backend/users
, it says
`ReflectionException
Class backend/UsersController does not exist`
Any help please?
Route::group(array('prefix' => 'backend'), function() {
Route::get('users', array('as' => 'user_index', 'uses' => 'UsersController@index'));
});
the other way you can achieve that is
Route::group(['namespace'=>'your-namespace-in-full'], function()
{
Route::controller('users/index', 'UsersController',array(
'index'=>'users.index',
));
});