@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | namespace Ghaskell\Scaffold\Facades; |
10 | 10 | use Illuminate\Support\Facades\Facade; |
11 | -class Code extends Facade{ |
|
11 | +class Code extends Facade { |
|
12 | 12 | protected static function getFacadeAccessor() |
13 | 13 | { |
14 | 14 | return 'code'; |
@@ -8,7 +8,7 @@ |
||
8 | 8 | |
9 | 9 | namespace Ghaskell\Scaffold\Facades; |
10 | 10 | use Illuminate\Support\Facades\Facade; |
11 | -class Vibro extends Facade{ |
|
11 | +class Vibro extends Facade { |
|
12 | 12 | protected static function getFacadeAccessor() |
13 | 13 | { |
14 | 14 | return 'vibro'; |
@@ -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() |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | |
16 | 16 | class VibroServiceProvider extends ViewServiceProvider |
17 | 17 | { |
18 | - const CONFIG_PATH = __DIR__ . '/../config/scaffold.php'; |
|
18 | + const CONFIG_PATH = __DIR__.'/../config/scaffold.php'; |
|
19 | 19 | |
20 | 20 | public function boot() |
21 | 21 | { |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | |
27 | 27 | public function register() |
28 | 28 | { |
29 | - $this->app->singleton('vibro.compiler', function () { |
|
29 | + $this->app->singleton('vibro.compiler', function() { |
|
30 | 30 | return new VibroCompiler( |
31 | 31 | $this->app['files'], $this->app['config']['view.compiled'] |
32 | 32 | ); |