From 34307581495e3dc34e8fb23922a19a92a5fa61ee Mon Sep 17 00:00:00 2001 From: Alexander Obuhovich Date: Sun, 27 Aug 2017 18:35:52 +0300 Subject: [PATCH] Fixes route urls building from Artisan for websites under sub-path --- .../Foundation/Bootstrap/SetRequestForConsole.php | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php b/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php index 8b7343ab3e8a..76d0b44bf891 100644 --- a/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php +++ b/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php @@ -15,8 +15,15 @@ class SetRequestForConsole */ public function bootstrap(Application $app) { - $app->instance('request', Request::create( - $app->make('config')->get('app.url', 'http://localhost'), 'GET', [], [], [], $_SERVER - )); + $uri = $app->make('config')->get('app.url', 'http://localhost'); + $components = parse_url($uri); + $server = $_SERVER; + + if (isset($components['path'])) { + $server['SCRIPT_FILENAME'] = $components['path']; + $server['SCRIPT_NAME'] = $components['path']; + } + + $app->instance('request', Request::create($uri, 'GET', [], [], [], $server)); } }