@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | class ServiceProvider extends \Illuminate\Support\ServiceProvider |
| 8 | 8 | { |
| 9 | - const CONFIG_PATH = __DIR__ . '/../config/scaffold.php'; |
|
| 9 | + const CONFIG_PATH = __DIR__.'/../config/scaffold.php'; |
|
| 10 | 10 | |
| 11 | 11 | public function boot() |
| 12 | 12 | { |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | ->buildApiController() |
| 71 | 71 | ->buildWebController() |
| 72 | 72 | ->addRoutes(); |
| 73 | - foreach($scaffold->messages as $message) { |
|
| 73 | + foreach ($scaffold->messages as $message) { |
|
| 74 | 74 | $this->line($message); |
| 75 | 75 | } |
| 76 | 76 | } |
@@ -83,10 +83,10 @@ discard block |
||
| 83 | 83 | $files = $finder->files() |
| 84 | 84 | ->name('*table.php') |
| 85 | 85 | ->notName('2014*') |
| 86 | - ->in(database_path() . '/migrations'); |
|
| 86 | + ->in(database_path().'/migrations'); |
|
| 87 | 87 | |
| 88 | 88 | foreach ($files as $file) { |
| 89 | - $this->migrations[] = $file->getRealPath() ; |
|
| 89 | + $this->migrations[] = $file->getRealPath(); |
|
| 90 | 90 | } |
| 91 | 91 | } |
| 92 | 92 | } |
@@ -33,7 +33,7 @@ discard block |
||
| 33 | 33 | |
| 34 | 34 | $this->template = new \Mustache_Engine([ |
| 35 | 35 | 'delimiters' => '<% %>', |
| 36 | - 'escape' => function ($value) { |
|
| 36 | + 'escape' => function($value) { |
|
| 37 | 37 | return $value; //no escaping. |
| 38 | 38 | } |
| 39 | 39 | ]); |
@@ -91,11 +91,11 @@ discard block |
||
| 91 | 91 | */ |
| 92 | 92 | public function getMigrationFiles($paths) |
| 93 | 93 | { |
| 94 | - return Collection::make($paths)->flatMap(function ($path) { |
|
| 94 | + return Collection::make($paths)->flatMap(function($path) { |
|
| 95 | 95 | return $this->files->glob($path.'/*_*.php'); |
| 96 | - })->filter()->sortBy(function ($file) { |
|
| 96 | + })->filter()->sortBy(function($file) { |
|
| 97 | 97 | return $this->getMigrationName($file); |
| 98 | - })->values()->keyBy(function ($file) { |
|
| 98 | + })->values()->keyBy(function($file) { |
|
| 99 | 99 | return $this->getMigrationName($file); |
| 100 | 100 | })->all(); |
| 101 | 101 | } |
@@ -144,7 +144,7 @@ discard block |
||
| 144 | 144 | { |
| 145 | 145 | $this->variables['modelName'] = $this->model->name; |
| 146 | 146 | |
| 147 | - $this->variables['modelVariable'] = "$" . Str::camel($this->model->name); |
|
| 147 | + $this->variables['modelVariable'] = "$".Str::camel($this->model->name); |
|
| 148 | 148 | |
| 149 | 149 | $this->variables['modelNameLower'] = Str::camel($this->model->name); |
| 150 | 150 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | public function build($stub) |
| 227 | 227 | { |
| 228 | 228 | $stub = $this->getStub($stub); |
| 229 | - if(!empty($stub)) { |
|
| 229 | + if (!empty($stub)) { |
|
| 230 | 230 | return $this->template |
| 231 | 231 | ->render( |
| 232 | 232 | $stub, |
@@ -243,45 +243,45 @@ discard block |
||
| 243 | 243 | if (starts_with($method, 'build')) { |
| 244 | 244 | if (str_contains($method, "Model")) { |
| 245 | 245 | $path = app_path($this->model->name); |
| 246 | - if($this->files->exists("$path.php")) { |
|
| 246 | + if ($this->files->exists("$path.php")) { |
|
| 247 | 247 | $this->messages[] = "File {$this->model->name}.php already exists."; |
| 248 | 248 | return $this; |
| 249 | 249 | } |
| 250 | 250 | } elseif (str_contains($method, "ApiController")) { |
| 251 | 251 | $path = app_path("Http/Controllers/Api/".$this->model->name."Controller"); |
| 252 | - if($this->files->exists("$path.php")) { |
|
| 252 | + if ($this->files->exists("$path.php")) { |
|
| 253 | 253 | $this->messages[] = "File $path.php already exists."; |
| 254 | 254 | return $this; |
| 255 | 255 | } |
| 256 | 256 | $this->files->makeDirectory(app_path("Http/Controllers/Api"), 0755, false, true); |
| 257 | 257 | } elseif (str_contains($method, "WebController")) { |
| 258 | 258 | $path = app_path("Http/Controllers/Web/".$this->model->name."Controller"); |
| 259 | - if($this->files->exists("$path.php")) { |
|
| 259 | + if ($this->files->exists("$path.php")) { |
|
| 260 | 260 | $this->messages[] = "File $path.php already exists."; |
| 261 | 261 | return $this; |
| 262 | 262 | } |
| 263 | 263 | $this->files->makeDirectory(app_path("Http/Controllers/Web"), 0755, false, true); |
| 264 | 264 | } elseif (str_contains($method, "Request")) { |
| 265 | 265 | $path = app_path("Http/Requests/".$this->model->name."Request"); |
| 266 | - if($this->files->exists("$path.php")) { |
|
| 266 | + if ($this->files->exists("$path.php")) { |
|
| 267 | 267 | $this->messages[] = "File {$this->model->name}Request.php already exists."; |
| 268 | 268 | return $this; |
| 269 | 269 | } |
| 270 | 270 | } else { |
| 271 | 271 | $path = app_path(); |
| 272 | - if($this->files->exists("$path.php")) { |
|
| 272 | + if ($this->files->exists("$path.php")) { |
|
| 273 | 273 | $this->messages[] = "File {$this->model->name}.php already exists."; |
| 274 | 274 | return $this; |
| 275 | 275 | } |
| 276 | 276 | } |
| 277 | 277 | |
| 278 | - if($this->files->exists("$path.php")) { |
|
| 278 | + if ($this->files->exists("$path.php")) { |
|
| 279 | 279 | $this->messages[] = "File {$this->model->name}Controller already exists."; |
| 280 | 280 | return $this; |
| 281 | 281 | } |
| 282 | 282 | $target = substr($method, 5); |
| 283 | 283 | $content = $this->build($target); |
| 284 | - if($content) { |
|
| 284 | + if ($content) { |
|
| 285 | 285 | $this->files->put("$path.php", $content); |
| 286 | 286 | } else { |
| 287 | 287 | $this->messages[] = "File stub $target not found."; |
@@ -293,7 +293,7 @@ discard block |
||
| 293 | 293 | |
| 294 | 294 | protected function getStub($stub) |
| 295 | 295 | { |
| 296 | - if($this->files->exists(app_path("Scaffold/stubs/$stub.stub"))) { |
|
| 296 | + if ($this->files->exists(app_path("Scaffold/stubs/$stub.stub"))) { |
|
| 297 | 297 | return $this->files->get(app_path("Scaffold/stubs/$stub.stub")); |
| 298 | 298 | } else { |
| 299 | 299 | return false; |