@@ -83,18 +83,18 @@ public function generateCollection()
83
83
public function generateRoute ()
84
84
{
85
85
$ this ->result = false ;
86
- if (app ()->version () >= 8 ) {
86
+ if (app ()->version () >= 8 ) {
87
87
$ nameSpace = "\nuse App\Http\Controllers\Api\{{modelName}}Controller; " ;
88
88
$ template = "Route::apiResource('{{modelNameLower}}', {{modelName}}Controller::class); \n" ;
89
89
$ nameSpace = str_replace ('{{modelName}} ' , $ this ->model , $ nameSpace );
90
- }else {
90
+ } else {
91
91
$ template = "Route::apiResource('{{modelNameLower}}', 'Api\{{modelName}}Controller'); \n" ;
92
92
}
93
93
$ route = str_replace ('{{modelNameLower}} ' , Str::camel (Str::plural ($ this ->model )), $ template );
94
94
$ route = str_replace ('{{modelName}} ' , $ this ->model , $ route );
95
95
if (! strpos (file_get_contents (base_path ('routes/api.php ' )), $ route )) {
96
96
file_put_contents (base_path ('routes/api.php ' ), $ route , FILE_APPEND );
97
- if (app ()->version () >= 8 ) {
97
+ if (app ()->version () >= 8 ) {
98
98
if (! strpos (file_get_contents (base_path ('routes/api.php ' )), $ nameSpace )) {
99
99
$ lines = file (base_path ('routes/api.php ' ));
100
100
$ lines [0 ] = $ lines [0 ]."\n" .$ nameSpace ;
@@ -103,6 +103,7 @@ public function generateRoute()
103
103
}
104
104
$ this ->result = true ;
105
105
}
106
+
106
107
return $ this ->result ;
107
108
}
108
109
0 commit comments