File tree Expand file tree Collapse file tree 2 files changed +30
-0
lines changed
Expand file tree Collapse file tree 2 files changed +30
-0
lines changed Original file line number Diff line number Diff line change @@ -18,6 +18,13 @@ public function __construct(string $path)
1818 $ this ->app ->make ('Illuminate\Contracts\Console\Kernel ' )->bootstrap ();
1919 }
2020
21+ public function init (): void
22+ {
23+ parent ::init ();
24+
25+ $ this ->bootAliases ();
26+ }
27+
2128 public function name (): string
2229 {
2330 return 'Laravel ' ;
@@ -50,4 +57,22 @@ public function casters(): array
5057
5158 return $ casters ;
5259 }
60+
61+ private function bootAliases (): void
62+ {
63+ if (! class_exists (\Laravel \Tinker \ClassAliasAutoloader::class)) {
64+ return ;
65+ }
66+
67+ $ config = $ this ->app ->make ('config ' );
68+
69+ $ path = \Illuminate \Support \Env::get ('COMPOSER_VENDOR_DIR ' , $ this ->app ->basePath ().DIRECTORY_SEPARATOR .'vendor ' );
70+
71+ \Laravel \Tinker \ClassAliasAutoloader::register (
72+ $ this ->tinker ->getShell (),
73+ $ path .'/composer/autoload_classmap.php ' ,
74+ $ config ->get ('tinker.alias ' , []),
75+ $ config ->get ('tinker.dont_alias ' , [])
76+ );
77+ }
5378}
Original file line number Diff line number Diff line change @@ -85,4 +85,9 @@ protected function cleanOutput(string $output): string
8585
8686 return trim ($ output );
8787 }
88+
89+ public function getShell (): Shell
90+ {
91+ return $ this ->shell ;
92+ }
8893}
You can’t perform that action at this time.
0 commit comments