Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Foundation\Bootstrap;
4
 
5
use Illuminate\Contracts\Foundation\Application;
6
use Illuminate\Http\Request;
7
 
8
class SetRequestForConsole
9
{
10
    /**
11
     * Bootstrap the given application.
12
     *
13
     * @param  \Illuminate\Contracts\Foundation\Application  $app
14
     * @return void
15
     */
16
    public function bootstrap(Application $app)
17
    {
18
        $uri = $app->make('config')->get('app.url', 'http://localhost');
19
 
20
        $components = parse_url($uri);
21
 
22
        $server = $_SERVER;
23
 
24
        if (isset($components['path'])) {
25
            $server = array_merge($server, [
26
                'SCRIPT_FILENAME' => $components['path'],
27
                'SCRIPT_NAME' => $components['path'],
28
            ]);
29
        }
30
 
31
        $app->instance('request', Request::create(
32
            $uri, 'GET', [], [], [], $server
33
        ));
34
    }
35
}