From 2a3e5918b418cf7489af7e1096a6be4c70afd64d Mon Sep 17 00:00:00 2001 From: Recca Tsai Date: Wed, 24 Feb 2016 02:56:48 +0800 Subject: [PATCH] update router --- resources/views/panel.blade.php | 2 +- src/Http/Controllers/TerminalController.php | 10 +++------- src/Http/routes.php | 2 +- 3 files changed, 5 insertions(+), 9 deletions(-) diff --git a/resources/views/panel.blade.php b/resources/views/panel.blade.php index 0346ff8..c40a67a 100644 --- a/resources/views/panel.blade.php +++ b/resources/views/panel.blade.php @@ -12,7 +12,7 @@ link.setAttribute("rel", "stylesheet"); link.setAttribute("type", "text/css"); link.setAttribute("href", filename); - link.setAttribute("id", id) + link.setAttribute("id", id); var head = document.getElementsByTagName('head'); if (head.length > 0) { diff --git a/src/Http/Controllers/TerminalController.php b/src/Http/Controllers/TerminalController.php index e22eb8c..b7331f2 100644 --- a/src/Http/Controllers/TerminalController.php +++ b/src/Http/Controllers/TerminalController.php @@ -24,7 +24,7 @@ public function __construct(ConsoleKernel $consoleKernel) * @param \Illuminate\Contracts\Foundation\Application $app * @param \Illuminate\Session\SessionManager $sessionManager * @param \Illuminate\Http\Request $request - * @param bool $panel + * @param string $view * * @return mixed */ @@ -32,7 +32,7 @@ public function index( ApplicationContract $app, SessionManager $sessionManager, Request $request, - $panel = false + $view = 'index' ) { $session = $sessionManager->driver(); if ($session->isStarted() === false) { @@ -68,11 +68,7 @@ public function index( ], ]); - if ($panel === true) { - return view('terminal::panel', compact('options', 'resources')); - } - - return view('terminal::index', compact('options', 'resources')); + return view('terminal::'.$view, compact('options', 'resources')); } /** diff --git a/src/Http/routes.php b/src/Http/routes.php index 3ea4815..39287ad 100644 --- a/src/Http/routes.php +++ b/src/Http/routes.php @@ -12,7 +12,7 @@ */ // Route::controller('/', 'TerminalController'); -Route::get('/', 'TerminalController@index'); +Route::get('/{view?}', 'TerminalController@index'); Route::post('/endpoint', 'TerminalController@endPoint'); Route::get('/media/{file}', 'TerminalController@media') ->where(['file' => '.+']);