33namespace Native \Laravel ;
44
55use Illuminate \Support \Arr ;
6+ use Native \Laravel \Commands \LoadPHPConfigurationCommand ;
67use Native \Laravel \Commands \LoadStartupConfigurationCommand ;
78use Native \Laravel \Commands \MigrateCommand ;
89use Native \Laravel \Commands \MinifyApplicationCommand ;
@@ -20,6 +21,7 @@ public function configurePackage(Package $package): void
2021 MigrateCommand::class,
2122 MinifyApplicationCommand::class,
2223 LoadStartupConfigurationCommand::class,
24+ LoadPHPConfigurationCommand::class,
2325 ])
2426 ->hasConfigFile ()
2527 ->hasRoute ('api ' )
@@ -49,6 +51,8 @@ protected function configureApp()
4951
5052 $ this ->rewriteDatabase ();
5153
54+ $ this ->configureDisks ();
55+
5256 config (['session.driver ' => 'file ' ]);
5357 config (['queue.default ' => 'database ' ]);
5458 }
@@ -96,4 +100,32 @@ public function rewriteDatabase()
96100
97101 config (['database.default ' => 'nativephp ' ]);
98102 }
103+
104+ protected function configureDisks (): void
105+ {
106+ $ disks = [
107+ 'NATIVEPHP_USER_HOME_PATH ' => 'user_home ' ,
108+ 'NATIVEPHP_APP_DATA_PATH ' => 'app_data ' ,
109+ 'NATIVEPHP_USER_DATA_PATH ' => 'user_data ' ,
110+ 'NATIVEPHP_DESKTOP_PATH ' => 'desktop ' ,
111+ 'NATIVEPHP_DOCUMENTS_PATH ' => 'documents ' ,
112+ 'NATIVEPHP_DOWNLOADS_PATH ' => 'downloads ' ,
113+ 'NATIVEPHP_MUSIC_PATH ' => 'music ' ,
114+ 'NATIVEPHP_PICTURES_PATH ' => 'pictures ' ,
115+ 'NATIVEPHP_VIDEOS_PATH ' => 'videos ' ,
116+ 'NATIVEPHP_RECENT_PATH ' => 'recent ' ,
117+ ];
118+
119+ foreach ($ disks as $ env => $ disk ) {
120+ if (! env ($ env )) {
121+ continue ;
122+ }
123+
124+ config (['filesystems.disks. ' .$ disk => [
125+ 'driver ' => 'local ' ,
126+ 'root ' => env ($ env , '' ),
127+ 'throw ' => false ,
128+ ]]);
129+ }
130+ }
99131}
0 commit comments