4
4
use Illuminate \Contracts \Container \Container ;
5
5
use Illuminate \Contracts \Events \Dispatcher ;
6
6
use Illuminate \Console \Events ;
7
+ use Illuminate \Http \Request ;
7
8
use Symfony \Component \Console \Application as SymfonyApplication ;
8
9
9
10
class Console extends Artisan
@@ -18,7 +19,7 @@ public function __construct(Container $laravel, Dispatcher $events, $version)
18
19
$ this ->events = $ events ;
19
20
$ this ->setAutoExit (false );
20
21
$ this ->setCatchExceptions (false );
21
-
22
+ $ this -> SetRequestForConsole ();
22
23
$ this ->events ->dispatch (new Events \ArtisanStarting ($ this ));
23
24
24
25
$ laravel ->loadDeferredProviders ();
@@ -33,4 +34,24 @@ protected function getDefaultInputDefinition()
33
34
{
34
35
return SymfonyApplication::getDefaultInputDefinition ();
35
36
}
37
+
38
+ private function SetRequestForConsole ()
39
+ {
40
+ $ uri = evo ()->getConfig ('site_url ' );
41
+
42
+ $ components = parse_url ($ uri );
43
+
44
+ $ server = $ _SERVER ;
45
+
46
+ if (isset ($ components ['path ' ])) {
47
+ $ server = array_merge ($ server , [
48
+ 'SCRIPT_FILENAME ' => $ components ['path ' ],
49
+ 'SCRIPT_NAME ' => $ components ['path ' ],
50
+ ]);
51
+ }
52
+
53
+ evo ()->instance ('request ' , Request::create (
54
+ $ uri , 'GET ' , [], [], [], $ server
55
+ ));
56
+ }
36
57
}
0 commit comments