Skip to content

Commit 05eaa22

Browse files
committed
添加好admin路由
1 parent 49325b3 commit 05eaa22

File tree

4 files changed

+46
-1
lines changed

4 files changed

+46
-1
lines changed

app/Http/Kernel.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,14 @@ class Kernel extends HttpKernel
3131
\App\Http\Middleware\VerifyCsrfToken::class,
3232
\Illuminate\Routing\Middleware\SubstituteBindings::class,
3333
],
34-
34+
'admin' => [
35+
\App\Http\Middleware\EncryptCookies::class,
36+
\Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class,
37+
\Illuminate\Session\Middleware\StartSession::class,
38+
\Illuminate\View\Middleware\ShareErrorsFromSession::class,
39+
\App\Http\Middleware\VerifyCsrfToken::class,
40+
\Illuminate\Routing\Middleware\SubstituteBindings::class,
41+
],
3542
'api' => [
3643
'throttle:60,1',
3744
'bindings',

app/Providers/RouteServiceProvider.php

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,29 @@ public function map()
3939

4040
$this->mapWebRoutes();
4141

42+
$this->mapAdminRoutes();
4243
//
4344
}
4445

46+
47+
/**
48+
* Define the "web" routes for the application.
49+
*
50+
* These routes all receive session state, CSRF protection, etc.
51+
*
52+
* @return void
53+
*/
54+
protected function mapAdminRoutes()
55+
{
56+
Route::group([
57+
'prefix'=>'/admin',
58+
'middleware' => 'admin',
59+
'namespace' => 'App\Http\Controllers\Admin',
60+
], function ($router) {
61+
require base_path('routes/admin.php');
62+
});
63+
}
64+
4565
/**
4666
* Define the "web" routes for the application.
4767
*

routes/admin.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?php
2+
3+
/*
4+
|--------------------------------------------------------------------------
5+
| Web Routes
6+
|--------------------------------------------------------------------------
7+
|
8+
| This file is where you may define all of the routes that are handled
9+
| by your application. Just tell Laravel the URIs it should respond
10+
| to using a Closure or controller method. Build something great!
11+
|
12+
*/
13+
14+
Route::get('/', function () {
15+
return view('welcome');
16+
});

storage/debugbar/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
*
2+
!.gitignore

0 commit comments

Comments
 (0)