@@ -28,11 +28,11 @@ discard block |
||
| 28 | 28 | |
| 29 | 29 | public static function make($migrationName) |
| 30 | 30 | { |
| 31 | - $scaffold = new Scaffold($migrationName); |
|
| 31 | + $scaffold = new Scaffold($migrationName); |
|
| 32 | 32 | $scaffold->files = new Filesystem(); |
| 33 | 33 | $scaffold->files->requireOnce($migrationName); |
| 34 | 34 | $migrationInstance = $scaffold->resolve($name = $scaffold->getMigrationName($migrationName)); //parse into instance |
| 35 | - $reflector = new \ReflectionClass($migrationInstance); //reflect |
|
| 35 | + $reflector = new \ReflectionClass($migrationInstance); //reflect |
|
| 36 | 36 | $migrationFileName = $reflector->getFileName(); |
| 37 | 37 | $scaffold->migration = $scaffold->files->get($migrationFileName); |
| 38 | 38 | $scaffold->model = ModelPattern::make($scaffold->migration); |
@@ -73,11 +73,11 @@ discard block |
||
| 73 | 73 | */ |
| 74 | 74 | public function getMigrationFiles($paths) |
| 75 | 75 | { |
| 76 | - return Collection::make($paths)->flatMap(function ($path) { |
|
| 76 | + return Collection::make($paths)->flatMap(function($path) { |
|
| 77 | 77 | return $this->files->glob($path.'/*_*.php'); |
| 78 | - })->filter()->sortBy(function ($file) { |
|
| 78 | + })->filter()->sortBy(function($file) { |
|
| 79 | 79 | return $this->getMigrationName($file); |
| 80 | - })->values()->keyBy(function ($file) { |
|
| 80 | + })->values()->keyBy(function($file) { |
|
| 81 | 81 | return $this->getMigrationName($file); |
| 82 | 82 | })->all(); |
| 83 | 83 | } |
@@ -95,13 +95,13 @@ discard block |
||
| 95 | 95 | public function build($stub) |
| 96 | 96 | { |
| 97 | 97 | $path = $this->getStubPath($stub); |
| 98 | - return Vibro::compileFile($path, $this->model ); |
|
| 98 | + return Vibro::compileFile($path, $this->model); |
|
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | protected function getStub($stub) |
| 102 | 102 | { |
| 103 | 103 | $stub = Str::camel($stub); |
| 104 | - if($this->files->exists(app_path("Scaffold/stubs/$stub.stub"))) { |
|
| 104 | + if ($this->files->exists(app_path("Scaffold/stubs/$stub.stub"))) { |
|
| 105 | 105 | return $this->files->get(app_path("Scaffold/stubs/$stub.stub")); |
| 106 | 106 | } else { |
| 107 | 107 | return false; |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | |
| 117 | 117 | public function addRoutes() |
| 118 | 118 | { |
| 119 | - foreach(config('scaffold.routes') as $key => $route) |
|
| 119 | + foreach (config('scaffold.routes') as $key => $route) |
|
| 120 | 120 | { |
| 121 | 121 | $namespace = Str::studly($key); |
| 122 | 122 | $routeContent = $this->files->get($route['fileName']); |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | '/([a-zA-Z])(?=[A-Z])/', |
| 125 | 125 | '$1-', $this->model->name |
| 126 | 126 | ))); |
| 127 | - if($key = 'web') { |
|
| 127 | + if ($key = 'web') { |
|
| 128 | 128 | $routeString = "\n\nRoute::resource('$uri', '$namespace\\{$this->model->name}Controller')->only(['index', 'show']);"; |
| 129 | 129 | } else { |
| 130 | 130 | $routeString = "\n\nRoute::apiResource('$uri', '$namespace\\{$this->model->name}Controller');"; |
@@ -146,19 +146,19 @@ discard block |
||
| 146 | 146 | $fileName = Vibro::compileFileName($config['fileNamePattern'], $this->model); |
| 147 | 147 | |
| 148 | 148 | $path = app_path("$pathPrefix/$fileName"); |
| 149 | - if($this->files->exists("$path")) { |
|
| 149 | + if ($this->files->exists("$path")) { |
|
| 150 | 150 | $this->messages[] = "File '$path' exists and was not overwritten."; |
| 151 | 151 | return $this; |
| 152 | 152 | } |
| 153 | 153 | |
| 154 | - if(!$this->files->isDirectory(app_path($pathPrefix))) { |
|
| 154 | + if (!$this->files->isDirectory(app_path($pathPrefix))) { |
|
| 155 | 155 | $this->files->makeDirectory(app_path("$pathPrefix")); |
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | // dd($this->model->fillable); |
| 159 | 159 | |
| 160 | 160 | $content = $this->build($target); |
| 161 | - if($content) { |
|
| 161 | + if ($content) { |
|
| 162 | 162 | $this->files->put("$path", $content); |
| 163 | 163 | $this->created[] = $path; |
| 164 | 164 | } else { |
@@ -72,10 +72,10 @@ discard block |
||
| 72 | 72 | // ->buildApiController() |
| 73 | 73 | // ->buildWebController() |
| 74 | 74 | // ->addRoutes(); |
| 75 | - foreach($scaffold->created as $created) { |
|
| 75 | + foreach ($scaffold->created as $created) { |
|
| 76 | 76 | $this->info("File '$created' generated."); |
| 77 | 77 | } |
| 78 | - foreach($scaffold->messages as $message) { |
|
| 78 | + foreach ($scaffold->messages as $message) { |
|
| 79 | 79 | $this->comment($message); |
| 80 | 80 | } |
| 81 | 81 | $this->line("------------------------------------------------------------------------------------------------------------------"); |
@@ -89,10 +89,10 @@ discard block |
||
| 89 | 89 | $files = $finder->files() |
| 90 | 90 | ->name('*table.php') |
| 91 | 91 | ->notName('2014*') |
| 92 | - ->in(database_path() . '/migrations'); |
|
| 92 | + ->in(database_path().'/migrations'); |
|
| 93 | 93 | |
| 94 | 94 | foreach ($files as $file) { |
| 95 | - $this->migrations[] = $file->getRealPath() ; |
|
| 95 | + $this->migrations[] = $file->getRealPath(); |
|
| 96 | 96 | } |
| 97 | 97 | } |
| 98 | 98 | } |
@@ -72,7 +72,7 @@ |
||
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | private function processColumns() { |
| 75 | - foreach($this->columns as $column) { |
|
| 75 | + foreach ($this->columns as $column) { |
|
| 76 | 76 | $this->processColumn($column); |
| 77 | 77 | } |
| 78 | 78 | } |
@@ -62,7 +62,7 @@ |
||
| 62 | 62 | public function compileFileName($fileName, $model) { |
| 63 | 63 | $parsed = $this->compileString($fileName); |
| 64 | 64 | ob_start(); |
| 65 | - eval( '?>' . $parsed ); |
|
| 65 | + eval('?>'.$parsed); |
|
| 66 | 66 | $output = ob_get_contents(); |
| 67 | 67 | ob_end_clean(); |
| 68 | 68 | return $output; |
@@ -16,7 +16,7 @@ |
||
| 16 | 16 | public $config; |
| 17 | 17 | |
| 18 | 18 | public static function make(string $name, string $type) { |
| 19 | - $column = new ColumnPattern(); |
|
| 19 | + $column = new ColumnPattern(); |
|
| 20 | 20 | $column->name = $name; |
| 21 | 21 | $column->type = $type; |
| 22 | 22 | $column->config = config("scaffold.columnTypes.$type"); |
@@ -9,11 +9,11 @@ discard block |
||
| 9 | 9 | |
| 10 | 10 | class ServiceProvider extends \Illuminate\Support\ServiceProvider |
| 11 | 11 | { |
| 12 | - const CONFIG_PATH = __DIR__ . '/../config/scaffold.php'; |
|
| 12 | + const CONFIG_PATH = __DIR__.'/../config/scaffold.php'; |
|
| 13 | 13 | |
| 14 | 14 | public function boot() |
| 15 | 15 | { |
| 16 | - Code::addExtension('stub', 'vibro'); |
|
| 16 | + Code::addExtension('stub', 'vibro'); |
|
| 17 | 17 | $this->publishes([ |
| 18 | 18 | self::CONFIG_PATH => config_path('scaffold.php'), |
| 19 | 19 | ], 'config'); |
@@ -24,7 +24,7 @@ discard block |
||
| 24 | 24 | ]); |
| 25 | 25 | } |
| 26 | 26 | $this->publishes([ |
| 27 | - __DIR__ . '/stubs' => app_path('Scaffold/stubs') |
|
| 27 | + __DIR__.'/stubs' => app_path('Scaffold/stubs') |
|
| 28 | 28 | ], 'Scaffold Stubs'); |
| 29 | 29 | } |
| 30 | 30 | public function register() |
@@ -35,7 +35,7 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public function registerFactory() |
| 37 | 37 | { |
| 38 | - $this->app->singleton('code', function ($app) { |
|
| 38 | + $this->app->singleton('code', function($app) { |
|
| 39 | 39 | // Next we need to grab the engine resolver instance that will be used by the |
| 40 | 40 | // environment. The resolver will be used by an environment to get each of |
| 41 | 41 | // the various engine implementations such as plain PHP or Blade engine. |
@@ -63,7 +63,7 @@ discard block |
||
| 63 | 63 | */ |
| 64 | 64 | public function registerViewFinder() |
| 65 | 65 | { |
| 66 | - $this->app->bind('code.finder', function ($app) { |
|
| 66 | + $this->app->bind('code.finder', function($app) { |
|
| 67 | 67 | return new FileViewFinder($app['files'], $app['config']['view.paths']); |
| 68 | 68 | }); |
| 69 | 69 | } |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | */ |
| 76 | 76 | public function registerEngineResolver() |
| 77 | 77 | { |
| 78 | - $this->app->singleton('view.engine.resolver', function () { |
|
| 78 | + $this->app->singleton('view.engine.resolver', function() { |
|
| 79 | 79 | $resolver = new EngineResolver; |
| 80 | 80 | |
| 81 | 81 | // Next, we will register the various view engines with the resolver so that the |
@@ -98,13 +98,13 @@ discard block |
||
| 98 | 98 | // The Compiler engine requires an instance of the CompilerInterface, which in |
| 99 | 99 | // this case will be the Blade compiler, so we'll first create the compiler |
| 100 | 100 | // instance to pass into the engine so it can compile the views properly. |
| 101 | - $this->app->singleton('vibro.compiler', function () { |
|
| 101 | + $this->app->singleton('vibro.compiler', function() { |
|
| 102 | 102 | return new VibroCompiler( |
| 103 | 103 | $this->app['files'], $this->app['config']['view.compiled'] |
| 104 | 104 | ); |
| 105 | 105 | }); |
| 106 | 106 | |
| 107 | - $resolver->register('vibro', function () { |
|
| 107 | + $resolver->register('vibro', function() { |
|
| 108 | 108 | return new CodeCompilerEngine($this->app['vibro.compiler']); |
| 109 | 109 | }); |
| 110 | 110 | } |