Commit e3d775c7 authored by Nicolas Widart's avatar Nicolas Widart

Squashed 'Modules/User/' changes from 387e439..6206740

6206740 Add the new route service provider. Adapt the routes accordingly.

git-subtree-dir: Modules/User
git-subtree-split: 6206740d9ec2e91f433a3f7c9cb8daf5241433ab
parent fc8509bf
<?php <?php
Route::group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'LaravelLocalizationRedirectFilter|auth.admin|permissions'], function() $router->group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'LaravelLocalizationRedirectFilter|auth.admin|permissions'], function($router)
{ {
Route::group(['prefix' => Config::get('core::core.admin-prefix'), 'namespace' => 'Modules\User\Http\Controllers'], function() $router->group(['prefix' => Config::get('core::core.admin-prefix')], function($router)
{ {
Route::resource('users', 'Admin\UserController', ['except' => ['show'], 'names' => [ $router->resource('users', 'Admin\UserController', ['except' => ['show'], 'names' => [
'index' => 'dashboard.user.index', 'index' => 'dashboard.user.index',
'create' => 'dashboard.user.create', 'create' => 'dashboard.user.create',
'store' => 'dashboard.user.store', 'store' => 'dashboard.user.store',
...@@ -12,7 +12,7 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'Laravel ...@@ -12,7 +12,7 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'Laravel
'update' => 'dashboard.user.update', 'update' => 'dashboard.user.update',
'destroy' => 'dashboard.user.destroy', 'destroy' => 'dashboard.user.destroy',
]]); ]]);
Route::resource('roles', 'Admin\RolesController', ['except' => ['show'], 'names' => [ $router->resource('roles', 'Admin\RolesController', ['except' => ['show'], 'names' => [
'index' => 'dashboard.role.index', 'index' => 'dashboard.role.index',
'create' => 'dashboard.role.create', 'create' => 'dashboard.role.create',
'store' => 'dashboard.role.store', 'store' => 'dashboard.role.store',
...@@ -23,21 +23,21 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'Laravel ...@@ -23,21 +23,21 @@ Route::group(['prefix' => LaravelLocalization::setLocale(), 'before' => 'Laravel
}); });
}); });
Route::group(['prefix' => 'auth', 'namespace' => 'Modules\User\Http\Controllers'], function() $router->group(['prefix' => 'auth'], function($router)
{ {
# Login # Login
Route::get('login', ['before' => 'auth.guest', 'as' => 'login', 'uses' => 'AuthController@getLogin']); $router->get('login', ['before' => 'auth.guest', 'as' => 'login', 'uses' => 'AuthController@getLogin']);
Route::post('login', array('as' => 'login.post', 'uses' => 'AuthController@postLogin')); $router->post('login', array('as' => 'login.post', 'uses' => 'AuthController@postLogin'));
# Register # Register
Route::get('register', ['before' => 'auth.guest', 'as' => 'register', 'uses' => 'AuthController@getRegister']); $router->get('register', ['before' => 'auth.guest', 'as' => 'register', 'uses' => 'AuthController@getRegister']);
Route::post('register', array('as' => 'register.post', 'uses' => 'AuthController@postRegister')); $router->post('register', array('as' => 'register.post', 'uses' => 'AuthController@postRegister'));
# Account Activation # Account Activation
Route::get('activate/{userId}/{activationCode}', 'AuthController@getActivate'); $router->get('activate/{userId}/{activationCode}', 'AuthController@getActivate');
# Reset password # Reset password
Route::get('reset', ['as' => 'reset', 'uses' => 'AuthController@getReset']); $router->get('reset', ['as' => 'reset', 'uses' => 'AuthController@getReset']);
Route::post('reset', ['as' => 'reset.post', 'uses' => 'AuthController@postReset']); $router->post('reset', ['as' => 'reset.post', 'uses' => 'AuthController@postReset']);
Route::get('reset/{id}/{code}', ['as' => 'reset.complete', 'uses' => 'AuthController@getResetComplete']); $router->get('reset/{id}/{code}', ['as' => 'reset.complete', 'uses' => 'AuthController@getResetComplete']);
Route::post('reset/{id}/{code}', ['as' => 'reset.complete.post', 'uses' => 'AuthController@postResetComplete']); $router->post('reset/{id}/{code}', ['as' => 'reset.complete.post', 'uses' => 'AuthController@postResetComplete']);
# Logout # Logout
Route::get('logout', array('as' => 'logout', 'uses' => 'AuthController@getLogout')); $router->get('logout', array('as' => 'logout', 'uses' => 'AuthController@getLogout'));
}); });
<?php namespace Modules\User\Providers;
use Illuminate\Routing\Router;
use Illuminate\Contracts\Routing\UrlGenerator;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
{
/**
* Called before routes are registered.
*
* Register any model bindings or pattern based filters.
*
* @param Router $router
* @param UrlGenerator $url
* @return void
*/
public function before(Router $router, UrlGenerator $url)
{
$url->setRootControllerNamespace('Modules\User\Http\Controllers');
}
/**
* Define the routes for the application.
*
* @return void
*/
public function map()
{
$this->app->booted(function()
{
$this->namespaced('Modules\User\Http\Controllers', function(Router $router)
{
require __DIR__ . '/../Http/routes.php';
});
});
}
}
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
"keywords": [], "keywords": [],
"active": 1, "active": 1,
"providers": [ "providers": [
"Modules\\User\\Providers\\UserServiceProvider" "Modules\\User\\Providers\\UserServiceProvider",
"Modules\\User\\Providers\\RouteServiceProvider"
] ]
} }
\ No newline at end of file
...@@ -16,16 +16,7 @@ Lang::addNamespace('user', __DIR__ . '/Resources/lang/'); ...@@ -16,16 +16,7 @@ Lang::addNamespace('user', __DIR__ . '/Resources/lang/');
Config::addNamespace('user', __DIR__ . '/Config/'); Config::addNamespace('user', __DIR__ . '/Config/');
/*
|--------------------------------------------------------------------------
| Require The Routes file.
|--------------------------------------------------------------------------
|
| Next, this module will load filters and routes file.
|
*/
require __DIR__ . '/Http/routes.php';
require __DIR__ . '/composers.php'; require __DIR__ . '/composers.php';
require __DIR__ . '/helpers.php'; require __DIR__ . '/helpers.php';
require __DIR__ . '/listeners.php'; require __DIR__ . '/listeners.php';
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment