Skip to content

Commit

Permalink
Fixes route urls building from Artisan for websites under sub-path
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander Obuhovich committed Aug 27, 2017
1 parent 23b8d99 commit 3430758
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
}

0 comments on commit 3430758

Please sign in to comment.