fix routes for setup wizard

This commit is contained in:
printempw 2016-11-18 16:59:05 +08:00
parent 589be0c892
commit 7004ab627c
4 changed files with 49 additions and 17 deletions

View File

@ -29,7 +29,6 @@ class Kernel extends HttpKernel
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
\Illuminate\Session\Middleware\StartSession::class,
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
\App\Http\Middleware\CheckSessionUserValid::class,
\App\Http\Middleware\Internationalization::class,
//\App\Http\Middleware\VerifyCsrfToken::class,
],

25
app/Http/Routes/setup.php Normal file
View File

@ -0,0 +1,25 @@
<?php
/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
/**
* Setup Wizard
*/
Route::group(['prefix' => 'setup'], function ()
{
Route::get ('/', 'SetupController@welcome');
Route::get ('/info', 'SetupController@info');
Route::post('/finish', 'SetupController@finish');
Route::get ('/update', 'SetupController@update');
Route::post('/update', 'SetupController@doUpdate');
});

View File

@ -16,19 +16,6 @@ Route::get('/index.php', 'HomeController@index');
Route::get('/locale/{lang}', 'HomeController@locale');
/**
* Setup Wizard
*/
Route::group(['prefix' => 'setup'], function ()
{
Route::get ('/', 'SetupController@welcome');
Route::get ('/info', 'SetupController@info');
Route::post('/finish', 'SetupController@finish');
Route::get ('/update', 'SetupController@update');
Route::post('/update', 'SetupController@doUpdate');
});
/**
* Auth
*/

View File

@ -4,6 +4,7 @@ namespace App\Providers;
use Illuminate\Routing\Router;
use App\Events\ConfigureRoutes;
use App\Http\Middleware\CheckSessionUserValid;
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
class RouteServiceProvider extends ServiceProvider
@ -38,6 +39,8 @@ class RouteServiceProvider extends ServiceProvider
*/
public function map(Router $router)
{
$this->mapSetupRoutes($router);
$this->mapStaticRoutes($router);
$this->mapWebRoutes($router);
@ -56,7 +59,7 @@ class RouteServiceProvider extends ServiceProvider
protected function mapWebRoutes(Router $router)
{
$router->group([
'middleware' => 'web',
'middleware' => ['web', CheckSessionUserValid::class],
'namespace' => $this->namespace,
], function ($router) {
require app_path('Http/Routes/web.php');
@ -64,9 +67,27 @@ class RouteServiceProvider extends ServiceProvider
}
/**
* Define the "api" routes for the application.
* Define the "setup" routes for the application.
*
* These routes are typically stateless.
* The routes for setup wizard.
*
* @param \Illuminate\Routing\Router $router
* @return void
*/
protected function mapSetupRoutes(Router $router)
{
$router->group([
'middleware' => 'web',
'namespace' => $this->namespace,
], function ($router) {
require app_path('Http/Routes/setup.php');
});
}
/**
* Define the "static" routes for the application.
*
* These routes will not load session, etc.
*
* @param \Illuminate\Routing\Router $router
* @return void