@@ -10,14 +10,14 @@ discard block |
||
10 | 10 | class ApisGeneratorServiceProviders extends ServiceProvider |
11 | 11 | { |
12 | 12 | |
13 | - public function boot(){ |
|
13 | + public function boot() { |
|
14 | 14 | $this->registerFacades(); |
15 | 15 | $this->publishesPackages(); |
16 | 16 | $this->loadResource(); |
17 | 17 | |
18 | 18 | } |
19 | 19 | |
20 | - public function register(){ |
|
20 | + public function register() { |
|
21 | 21 | $this->commands([ |
22 | 22 | TestCommands::class |
23 | 23 | ]); |
@@ -30,13 +30,13 @@ discard block |
||
30 | 30 | |
31 | 31 | protected function registerFacades() |
32 | 32 | { |
33 | - $this->app->singleton("KMFileFacade" , function ($app){ |
|
33 | + $this->app->singleton("KMFileFacade", function($app) { |
|
34 | 34 | return new KMFile(); |
35 | 35 | }); |
36 | - $this->app->singleton("KMRoutesFacade" , function ($app){ |
|
36 | + $this->app->singleton("KMRoutesFacade", function($app) { |
|
37 | 37 | return new KMRoutes(); |
38 | 38 | }); |
39 | - $this->app->singleton("KMFunctionsFacade" , function ($app){ |
|
39 | + $this->app->singleton("KMFunctionsFacade", function($app) { |
|
40 | 40 | return new KMFunctions(); |
41 | 41 | }); |
42 | 42 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | $cssPath = "ApisGenerator/css"; |
49 | 49 | $this->publishes([ |
50 | 50 | __DIR__."/../Config/apis_generator.php" => config_path("apis_generator.php") |
51 | - ] , "apis-generator-config"); |
|
51 | + ], "apis-generator-config"); |
|
52 | 52 | |
53 | 53 | $this->publishes([ |
54 | 54 | $asset."create.blade.php" => resource_path("$views/create.blade.php"), |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | $asset."_layouts.blade.php" => resource_path("$views/layouts/_layouts.blade.php"), |
58 | 58 | $asset."script.js" => public_path("$scriptPath/script.js"), |
59 | 59 | $asset."css.css" => public_path("$cssPath/css.css"), |
60 | - ] , "apis-generator-asset"); |
|
60 | + ], "apis-generator-asset"); |
|
61 | 61 | |
62 | 62 | } |
63 | 63 |
@@ -4,16 +4,16 @@ |
||
4 | 4 | use KMLaravel\ApiGenerator\Facade\KMFunctionsFacade; |
5 | 5 | |
6 | 6 | Route::namespace("KMLaravel\ApiGenerator\Controllers") |
7 | - ->group(function () { |
|
7 | + ->group(function() { |
|
8 | 8 | // this is pull middleware information from apis_generator.php config file |
9 | - Route::group(['middleware' => array_merge(['web'], KMFunctionsFacade::getMiddleware())], function () { |
|
10 | - Route::group([], function () { |
|
9 | + Route::group(['middleware' => array_merge(['web'], KMFunctionsFacade::getMiddleware())], function() { |
|
10 | + Route::group([], function() { |
|
11 | 11 | // all apis table page |
12 | - Route::get('/apis-generator/index', function () { |
|
12 | + Route::get('/apis-generator/index', function() { |
|
13 | 13 | return view('ApisGenerator/index'); |
14 | 14 | })->name('apisGenerator.index'); |
15 | 15 | // create new api page |
16 | - Route::get('/apis-generator/create', function () { |
|
16 | + Route::get('/apis-generator/create', function() { |
|
17 | 17 | return view('ApisGenerator/create'); |
18 | 18 | })->name('apisGenerator.create'); |
19 | 19 | // post information route |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | */ |
51 | 51 | public function initialRequest($request): GeneratorService |
52 | 52 | { |
53 | - [$this->request , $this->column , $this->apiTitle ] = [$request , $request->column , $request->title]; |
|
53 | + [$this->request, $this->column, $this->apiTitle] = [$request, $request->column, $request->title]; |
|
54 | 54 | // append all basic options that actor want to run migration to new array |
55 | 55 | foreach ($this->request->basic_options as $item => $status) { |
56 | 56 | $this->basicBuildOption [] = $item; |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | $this->setBaseControllerExists(); |
84 | 84 | // merge basic options and advanced options. |
85 | 85 | //we here want to be advanced options last options to run inside foreach. |
86 | - $options = array_merge($this->basicBuildOption , $this->advancedBuildOption); |
|
86 | + $options = array_merge($this->basicBuildOption, $this->advancedBuildOption); |
|
87 | 87 | foreach ($options as $option) { |
88 | 88 | if (method_exists(__CLASS__, $option)) { |
89 | 89 | $this->$option(); |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | { |
107 | 107 | $builder = new KMModelAndMigrationBuilder(); |
108 | 108 | $modelClass = "$this->apiTitle"; |
109 | - $migrationRequired = in_array("buildMigration" , $this->basicBuildOption) ? "-m" : ""; |
|
109 | + $migrationRequired = in_array("buildMigration", $this->basicBuildOption) ? "-m" : ""; |
|
110 | 110 | $builder->initialResource($modelClass, "modelAndMigrationReplacer") |
111 | 111 | ->callArtisan($migrationRequired) |
112 | 112 | ->build($this->column, ["migrationRequired" => $migrationRequired]); |
@@ -147,7 +147,7 @@ discard block |
||
147 | 147 | protected function buildRequests() |
148 | 148 | { |
149 | 149 | $builder = new KMRequestBuilder(); |
150 | - $requestClass = "$this->apiTitle" . "Request"; |
|
150 | + $requestClass = "$this->apiTitle"."Request"; |
|
151 | 151 | $builder->initialResource($requestClass, "requestReplacer") |
152 | 152 | ->callArtisan() |
153 | 153 | ->build($this->column); |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | protected function buildController() |
169 | 169 | { |
170 | 170 | $builder = new KMControllerBuilder(); |
171 | - $controllerClass = "$this->apiTitle" . "Controller"; |
|
171 | + $controllerClass = "$this->apiTitle"."Controller"; |
|
172 | 172 | $controllerBuildType = !$this->baseControllerExists ? "basicBuild" : "build"; |
173 | 173 | return $builder->initialResource($controllerClass, "controllerReplacer") |
174 | 174 | ->callArtisan() |
@@ -183,8 +183,8 @@ discard block |
||
183 | 183 | */ |
184 | 184 | protected function buildResource() |
185 | 185 | { |
186 | - Artisan::call("make:resource " . "$this->apiTitle" . "Resource"); |
|
187 | - return $this->paths["{{ resource_path }}"] = KMFileFacade::getClassNameSpace("Resources", "$this->apiTitle" . "Resource"); |
|
186 | + Artisan::call("make:resource "."$this->apiTitle"."Resource"); |
|
187 | + return $this->paths["{{ resource_path }}"] = KMFileFacade::getClassNameSpace("Resources", "$this->apiTitle"."Resource"); |
|
188 | 188 | } |
189 | 189 | |
190 | 190 | /** |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | { |
200 | 200 | $data = [ |
201 | 201 | "title" => $this->apiTitle, |
202 | - "route" => "$this->apiTitle" . "Controller", |
|
202 | + "route" => "$this->apiTitle"."Controller", |
|
203 | 203 | "url" => "$this->apiTitle", |
204 | 204 | "name" => "$this->apiTitle", |
205 | 205 | "type" => "resource", |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | $validation = []; |
77 | 77 | } |
78 | 78 | return $this->replacement( |
79 | - ["{{ rules }}", "{{ request_class }}" , "{{ request_auth }}"] |
|
80 | - , [$validationRow, $this->fileName , KMFunctionsFacade::getRequestAuthAccessibility()], |
|
79 | + ["{{ rules }}", "{{ request_class }}", "{{ request_auth }}"] |
|
80 | + , [$validationRow, $this->fileName, KMFunctionsFacade::getRequestAuthAccessibility()], |
|
81 | 81 | $this->fileToCreate, $this->filepath); |
82 | 82 | } |
83 | 83 | |
@@ -93,7 +93,7 @@ discard block |
||
93 | 93 | // model area |
94 | 94 | $fillable = []; |
95 | 95 | $protectedFillable = ""; |
96 | - $databaseColumn = '$table->id();' . "\n"; |
|
96 | + $databaseColumn = '$table->id();'."\n"; |
|
97 | 97 | // we build here fillabel for model and column for migration file at once. |
98 | 98 | foreach ($columns as $name => $item) { |
99 | 99 | // build fillabe property in model. |
@@ -101,10 +101,10 @@ discard block |
||
101 | 101 | // get column type. |
102 | 102 | $type = array_key_first($item['type']); |
103 | 103 | // put this column as this ex : $table->string('name'). |
104 | - $databaseColumn .= '$table->' . "$type('$name'); \n"; |
|
104 | + $databaseColumn .= '$table->'."$type('$name'); \n"; |
|
105 | 105 | } |
106 | 106 | $imp = implode(",", $fillable); |
107 | - $protectedFillable .= 'protected $fillable = ' . " [$imp];"; |
|
107 | + $protectedFillable .= 'protected $fillable = '." [$imp];"; |
|
108 | 108 | $this->replacement("//", $protectedFillable, $options["file"], $options["path"]); |
109 | 109 | // check if user choose to build migration. |
110 | 110 | if (isset($options['migrationRequired'])) { |
@@ -9,9 +9,9 @@ |
||
9 | 9 | { |
10 | 10 | public static function getRoutes() |
11 | 11 | { |
12 | - return Route::group([], function () { |
|
12 | + return Route::group([], function() { |
|
13 | 13 | $extraRoutes = KMFileFacade::getCredentialJsonFileAsJson(); |
14 | - if (isset($extraRoutes)){ |
|
14 | + if (isset($extraRoutes)) { |
|
15 | 15 | foreach ($extraRoutes as $api) { |
16 | 16 | if (isset($api->route) && isset($api->url)) { |
17 | 17 | Route::apiResource($api->url, $api->route); |