File tree Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Expand file tree Collapse file tree 1 file changed +22
-2
lines changed Original file line number Diff line number Diff line change @@ -71,13 +71,15 @@ public function handle()
7171 {
7272 $ this ->callSilent ('route:clear ' );
7373
74+ $ app = $ this ->getFreshApplication ();
75+
7476 $ this ->call ('route:cache ' );
7577
76- $ routes = $ this -> router ->getAdapterRoutes ();
78+ $ routes = $ app [ ' api. router' ] ->getAdapterRoutes ();
7779
7880 foreach ($ routes as $ collection ) {
7981 foreach ($ collection as $ route ) {
80- $ this -> adapter ->prepareRouteForSerialization ($ route );
82+ $ app [ ' api.router. adapter' ] ->prepareRouteForSerialization ($ route );
8183 }
8284 }
8385
@@ -93,4 +95,22 @@ public function handle()
9395 str_replace ('{{routes}} ' , base64_encode (serialize ($ routes )), $ stub )
9496 );
9597 }
98+
99+ /**
100+ * Get a fresh application instance.
101+ *
102+ * @return \Illuminate\Contracts\Container\Container
103+ */
104+ protected function getFreshApplication ()
105+ {
106+ if (method_exists ($ this ->laravel , 'bootstrapPath ' )) {
107+ $ app = require $ this ->laravel ->bootstrapPath ().'/app.php ' ;
108+ } else {
109+ $ app = require $ this ->laravel ->basePath ().'/bootstrap/app.php ' ;
110+ }
111+
112+ $ app ->make (Kernel::class)->bootstrap ();
113+
114+ return $ app ;
115+ }
96116}
You can’t perform that action at this time.
0 commit comments