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 13
13
],
14
14
15
15
'stubs ' => [
16
- 'entity ' => 'app ' .'Stubs ' .DR .'Entity ' .DR ,
16
+ 'entity ' => 'app ' .DR . 'Stubs ' .DR .'Entity ' .DR ,
17
17
'factory ' => 'app ' .DR .'Stubs ' .DR .'Factory ' .DR ,
18
18
'resource ' => 'app ' .DR .'Stubs ' .DR .'Resource ' .DR ,
19
19
'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
44
44
$ entityName = str_singular (ucfirst (camel_case ($ tableName )));
45
45
$ entityVariableName = camel_case ($ entityName );
46
46
$ factoryName = $ entityName . "Factory " ;
47
+ $ factoryNamespace = config ('repository.path.namespace.factories ' );
47
48
$ relativeFactoriesPath = config ('repository.path.relative.factories ' );
48
49
49
50
if ($ this ->option ('delete ' )) {
@@ -52,8 +53,9 @@ public function handle(): int
52
53
return 0 ;
53
54
}
54
55
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 ;
57
59
}
58
60
59
61
if (class_exists ("$ relativeFactoriesPath \\$ factoryName " ) && !$ this ->option ('force ' )) {
@@ -69,7 +71,7 @@ public function handle(): int
69
71
}
70
72
71
73
// Initialize Class
72
- $ factoryContent = "<?php \n\nnamespace $ relativeFactoriesPath ; \n\n" ;
74
+ $ factoryContent = "<?php \n\nnamespace $ factoryNamespace ; \n\n" ;
73
75
$ factoryContent .= "use App\Models\Entities \\$ entityName; \nuse stdClass; \n\n" ;
74
76
$ factoryContent .= "class $ factoryName extends Factory \n{ \n" ;
75
77
You can’t perform that action at this time.
0 commit comments