File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change 1313 ],
1414
1515 'stubs ' => [
16- 'entity ' => 'app ' .'Stubs ' .DR .'Entity ' .DR ,
16+ 'entity ' => 'app ' .DR . 'Stubs ' .DR .'Entity ' .DR ,
1717 'factory ' => 'app ' .DR .'Stubs ' .DR .'Factory ' .DR ,
1818 'resource ' => 'app ' .DR .'Stubs ' .DR .'Resource ' .DR ,
1919 'repository ' => 'app ' .DR .'Stubs ' .DR .'Repository ' .DR ,
Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ public function handle(): int
4444 $ entityName = str_singular (ucfirst (camel_case ($ tableName )));
4545 $ entityVariableName = camel_case ($ entityName );
4646 $ factoryName = $ entityName . "Factory " ;
47+ $ factoryNamespace = config ('repository.path.namespace.factories ' );
4748 $ relativeFactoriesPath = config ('repository.path.relative.factories ' );
4849
4950 if ($ this ->option ('delete ' )) {
@@ -52,8 +53,9 @@ public function handle(): int
5253 return 0 ;
5354 }
5455
55- if (!file_exists ($ relativeFactoriesPath )) {
56- mkdir ($ relativeFactoriesPath , 775 , true );
56+ if ( ! file_exists ($ relativeFactoriesPath ) && ! mkdir ($ relativeFactoriesPath , 775 , true ) && ! is_dir ($ relativeFactoriesPath )) {
57+ $ this ->alert ("Directory \"$ relativeFactoriesPath \" was not created " );
58+ return 0 ;
5759 }
5860
5961 if (class_exists ("$ relativeFactoriesPath \\$ factoryName " ) && !$ this ->option ('force ' )) {
@@ -69,7 +71,7 @@ public function handle(): int
6971 }
7072
7173 // Initialize Class
72- $ factoryContent = "<?php \n\nnamespace $ relativeFactoriesPath ; \n\n" ;
74+ $ factoryContent = "<?php \n\nnamespace $ factoryNamespace ; \n\n" ;
7375 $ factoryContent .= "use App\Models\Entities \\$ entityName; \nuse stdClass; \n\n" ;
7476 $ factoryContent .= "class $ factoryName extends Factory \n{ \n" ;
7577
You can’t perform that action at this time.
0 commit comments