@@ -35,12 +35,12 @@ |
||
35 | 35 | */ |
36 | 36 | public function register() |
37 | 37 | { |
38 | - $this->app->singleton('scaffolder.command.generate', function ($app) |
|
38 | + $this->app->singleton('scaffolder.command.generate', function($app) |
|
39 | 39 | { |
40 | 40 | return new GeneratorCommand($app['scaffolder.theme.views'], $app['scaffolder.theme.layouts']); |
41 | 41 | }); |
42 | 42 | |
43 | - $this->app->singleton('scaffolder.command.cache.clear', function () |
|
43 | + $this->app->singleton('scaffolder.command.cache.clear', function() |
|
44 | 44 | { |
45 | 45 | return new ClearCacheCommand(); |
46 | 46 | }); |
@@ -37,8 +37,7 @@ discard block |
||
37 | 37 | if (File::exists(base_path('scaffolder-config/cache/migration_' . $hash . self::CACHE_EXT))) |
38 | 38 | { |
39 | 39 | return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash)); |
40 | - } |
|
41 | - else |
|
40 | + } else |
|
42 | 41 | { |
43 | 42 | $this->stub = $stub; |
44 | 43 | |
@@ -67,8 +66,7 @@ discard block |
||
67 | 66 | if ($fileToCompile->cached) |
68 | 67 | { |
69 | 68 | File::copy(base_path('scaffolder-config/cache/migration_' . $fileToCompile->hash . self::CACHE_EXT), $path); |
70 | - } |
|
71 | - else |
|
69 | + } else |
|
72 | 70 | { |
73 | 71 | File::put(base_path('scaffolder-config/cache/migration_' . $fileToCompile->hash . self::CACHE_EXT), $compiled); |
74 | 72 | File::copy(base_path('scaffolder-config/cache/migration_' . $fileToCompile->hash . self::CACHE_EXT), $path); |
@@ -129,8 +127,7 @@ discard block |
||
129 | 127 | if (count($modifierAndValue) == 2) |
130 | 128 | { |
131 | 129 | $parsedModifiers .= '->' . $modifierAndValue[0] . '(' . $modifierAndValue[1] . ')'; |
132 | - } |
|
133 | - else |
|
130 | + } else |
|
134 | 131 | { |
135 | 132 | $parsedModifiers .= '->' . $modifierAndValue[0] . '()'; |
136 | 133 | } |
@@ -141,8 +138,7 @@ discard block |
||
141 | 138 | if ($field->index != 'none') |
142 | 139 | { |
143 | 140 | $fields .= sprintf("\t\t\t\$table->%s('%s')%s->%s();" . PHP_EOL, $field->type->db, $field->name, $parsedModifiers, $field->index); |
144 | - } |
|
145 | - else |
|
141 | + } else |
|
146 | 142 | { |
147 | 143 | $fields .= sprintf("\t\t\t\$table->%s('%s')%s;" . PHP_EOL, $field->type->db, $field->name, $parsedModifiers); |
148 | 144 | } |
@@ -26,8 +26,7 @@ discard block |
||
26 | 26 | if (File::exists(base_path('scaffolder-config/cache/view_index_' . $hash . self::CACHE_EXT))) |
27 | 27 | { |
28 | 28 | return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash)); |
29 | - } |
|
30 | - else |
|
29 | + } else |
|
31 | 30 | { |
32 | 31 | $this->stub = $stub; |
33 | 32 | |
@@ -58,8 +57,7 @@ discard block |
||
58 | 57 | if ($fileToCompile->cached) |
59 | 58 | { |
60 | 59 | File::copy(base_path('scaffolder-config/cache/view_index_' . $fileToCompile->hash . self::CACHE_EXT), $path); |
61 | - } |
|
62 | - else |
|
60 | + } else |
|
63 | 61 | { |
64 | 62 | File::put(base_path('scaffolder-config/cache/view_index_' . $fileToCompile->hash . self::CACHE_EXT), $compiled); |
65 | 63 | File::copy(base_path('scaffolder-config/cache/view_index_' . $fileToCompile->hash . self::CACHE_EXT), $path); |
@@ -89,8 +87,7 @@ discard block |
||
89 | 87 | { |
90 | 88 | $fields .= sprintf("{ data: '%s', name: '%s' }," . PHP_EOL, $field->name, $field->name); |
91 | 89 | $firstIteration = false; |
92 | - } |
|
93 | - else |
|
90 | + } else |
|
94 | 91 | { |
95 | 92 | $fields .= sprintf("\t\t\t\t{ data: '%s', name: '%s' }," . PHP_EOL, $field->name, $field->name); |
96 | 93 | } |
@@ -124,8 +121,7 @@ discard block |
||
124 | 121 | $fields .= sprintf("<th>%s</th>" . PHP_EOL, ucfirst($field->name)); |
125 | 122 | $firstIteration = false; |
126 | 123 | |
127 | - } |
|
128 | - else |
|
124 | + } else |
|
129 | 125 | { |
130 | 126 | $fields .= sprintf("\t\t\t<th>%s</th>" . PHP_EOL, ucfirst($field->name)); |
131 | 127 | } |
@@ -29,8 +29,7 @@ discard block |
||
29 | 29 | if (File::exists(base_path('scaffolder-config/cache/view_edit_' . $hash . self::CACHE_EXT))) |
30 | 30 | { |
31 | 31 | return $this->store($modelName, $scaffolderConfig, '', new FileToCompile(true, $hash)); |
32 | - } |
|
33 | - else |
|
32 | + } else |
|
34 | 33 | { |
35 | 34 | $this->stub = $stub; |
36 | 35 | |
@@ -61,8 +60,7 @@ discard block |
||
61 | 60 | if ($fileToCompile->cached) |
62 | 61 | { |
63 | 62 | File::copy(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $path); |
64 | - } |
|
65 | - else |
|
63 | + } else |
|
66 | 64 | { |
67 | 65 | File::put(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $compiled); |
68 | 66 | File::copy(base_path('scaffolder-config/cache/view_edit_' . $fileToCompile->hash . self::CACHE_EXT), $path); |
@@ -89,8 +87,7 @@ discard block |
||
89 | 87 | { |
90 | 88 | $fields .= sprintf(self::getInputFor($field) . PHP_EOL, $field->name); |
91 | 89 | $firstIteration = false; |
92 | - } |
|
93 | - else |
|
90 | + } else |
|
94 | 91 | { |
95 | 92 | $fields .= sprintf("\t" . self::getInputFor($field) . PHP_EOL, $field->name); |
96 | 93 | } |
@@ -16,8 +16,7 @@ |
||
16 | 16 | if ($fieldData->type->ui == 'text') |
17 | 17 | { |
18 | 18 | return '{!! Form::text(\'%s\', (isset($model)) ? $model->' . $fieldData->name . ' : null) !!}'; |
19 | - } |
|
20 | - elseif ($fieldData->type->ui == 'textarea') |
|
19 | + } elseif ($fieldData->type->ui == 'textarea') |
|
21 | 20 | { |
22 | 21 | return '{!! Form::textarea(\'%s\', (isset($model)) ? $model->' . $fieldData->name . ' : null) !!}'; |
23 | 22 | } |
@@ -18,33 +18,26 @@ |
||
18 | 18 | if (head($path) == 'app') |
19 | 19 | { |
20 | 20 | $path = app_path(last($path)); |
21 | - } |
|
22 | - elseif (head($path) == 'base') |
|
21 | + } elseif (head($path) == 'base') |
|
23 | 22 | { |
24 | 23 | $path = base_path(last($path)); |
25 | - } |
|
26 | - elseif (head($path) == 'config') |
|
24 | + } elseif (head($path) == 'config') |
|
27 | 25 | { |
28 | 26 | $path = config_path(last($path)); |
29 | - } |
|
30 | - elseif (head($path) == 'database') |
|
27 | + } elseif (head($path) == 'database') |
|
31 | 28 | { |
32 | 29 | $path = database_path(last($path)); |
33 | - } |
|
34 | - elseif (head($path) == 'public') |
|
30 | + } elseif (head($path) == 'public') |
|
35 | 31 | { |
36 | 32 | $path = public_path(last($path)); |
37 | - } |
|
38 | - elseif (head($path) == 'storage') |
|
33 | + } elseif (head($path) == 'storage') |
|
39 | 34 | { |
40 | 35 | $path = storage_path(last($path)); |
41 | - } |
|
42 | - else |
|
36 | + } else |
|
43 | 37 | { |
44 | 38 | $path = head($path); |
45 | 39 | } |
46 | - } |
|
47 | - else |
|
40 | + } else |
|
48 | 41 | { |
49 | 42 | $path = head($path); |
50 | 43 | } |
@@ -43,19 +43,19 @@ discard block |
||
43 | 43 | } |
44 | 44 | |
45 | 45 | public function show($id) |
46 | - { |
|
47 | - return 'Not implemented'; |
|
48 | - } |
|
46 | + { |
|
47 | + return 'Not implemented'; |
|
48 | + } |
|
49 | 49 | |
50 | 50 | public function edit($id) |
51 | - { |
|
52 | - $model = {{class_name}}::find($id); |
|
51 | + { |
|
52 | + $model = {{class_name}}::find($id); |
|
53 | 53 | |
54 | 54 | return view('{{class_name_lw}}.edit')->with('model', $model); |
55 | - } |
|
55 | + } |
|
56 | 56 | |
57 | 57 | public function update($id, Request $request) |
58 | - { |
|
58 | + { |
|
59 | 59 | $this->validate($request, [ |
60 | 60 | |
61 | 61 | {{validations}} |
@@ -63,13 +63,13 @@ discard block |
||
63 | 63 | |
64 | 64 | {{class_name}}::find($id)->fill($request->all())->save(); |
65 | 65 | |
66 | - return response()->json(['message' => 'ok']); |
|
67 | - } |
|
66 | + return response()->json(['message' => 'ok']); |
|
67 | + } |
|
68 | 68 | |
69 | 69 | public function destroy($id) |
70 | - { |
|
70 | + { |
|
71 | 71 | {{class_name}}::destroy($id); |
72 | 72 | |
73 | - return response()->json(['message' => 'ok']); |
|
74 | - } |
|
73 | + return response()->json(['message' => 'ok']); |
|
74 | + } |
|
75 | 75 | } |
@@ -17,10 +17,10 @@ |
||
17 | 17 | public function get{{class_name}}s() |
18 | 18 | { |
19 | 19 | return Datatables::of({{class_name}}::select('*')) |
20 | - ->addColumn('action', function ($model) { |
|
20 | + ->addColumn('action', function($model) { |
|
21 | 21 | return ' |
22 | - <a href="/{{route_prefix}}/{{class_name_lw}}/'.$model->{{primaryKey}}.'/edit"><i class="material-icons">create</i></a> |
|
23 | - <a href="#" onclick="deleteModel(\''.$model->{{primaryKey}}.'\')"><i class="material-icons">delete</i></a>'; |
|
22 | + <a href="/{{route_prefix}}/{{class_name_lw}}/'.$model->{{primaryKey}} . '/edit"><i class="material-icons">create</i></a> |
|
23 | + <a href="#" onclick="deleteModel(\''.$model->{{primaryKey}} . '\')"><i class="material-icons">delete</i></a>'; |
|
24 | 24 | }) |
25 | 25 | ->make(true); |
26 | 26 | } |
@@ -3,14 +3,14 @@ |
||
3 | 3 | use Illuminate\Database\Schema\Blueprint; |
4 | 4 | use Illuminate\Database\Migrations\Migration; |
5 | 5 | |
6 | -class Create{{class_name}}sTable extends Migration |
|
6 | +class Create {{class_name}}sTable extends Migration |
|
7 | 7 | { |
8 | 8 | /** |
9 | 9 | * Run the migrations. |
10 | 10 | */ |
11 | 11 | public function up() |
12 | 12 | { |
13 | - Schema::create('{{table_name}}s', function (Blueprint $table) { |
|
13 | + Schema::create('{{table_name}}s', function(Blueprint $table) { |
|
14 | 14 | |
15 | 15 | {{fields}} |
16 | 16 | }); |
@@ -3,17 +3,17 @@ discard block |
||
3 | 3 | use Illuminate\Http\Request; |
4 | 4 | use Illuminate\Support\Facades\File; |
5 | 5 | |
6 | -Route::get('scaffolder/generator', function () |
|
6 | +Route::get('scaffolder/generator', function() |
|
7 | 7 | { |
8 | 8 | return view('scaffolder::generator'); |
9 | 9 | }); |
10 | 10 | |
11 | -Route::post('scaffolder/add-model', function (Request $request) |
|
11 | +Route::post('scaffolder/add-model', function(Request $request) |
|
12 | 12 | { |
13 | 13 | return view('scaffolder::partials.model', ['modelId' => $request->input('modelId')]); |
14 | 14 | }); |
15 | 15 | |
16 | -Route::post('scaffolder/add-field', function (Request $request) |
|
16 | +Route::post('scaffolder/add-field', function(Request $request) |
|
17 | 17 | { |
18 | 18 | return view('scaffolder::partials.field', [ |
19 | 19 | 'modelId' => $request->input('modelId'), |
@@ -21,11 +21,11 @@ discard block |
||
21 | 21 | ]); |
22 | 22 | }); |
23 | 23 | |
24 | -Route::post('scaffolder/generate', function (Request $request) |
|
24 | +Route::post('scaffolder/generate', function(Request $request) |
|
25 | 25 | { |
26 | 26 | $models = $request->only('models'); |
27 | 27 | |
28 | - array_walk_recursive($models, function (&$item) |
|
28 | + array_walk_recursive($models, function(&$item) |
|
29 | 29 | { |
30 | 30 | if ($item == 'true') $item = true; |
31 | 31 | elseif ($item == 'false') $item = false; |
@@ -45,11 +45,11 @@ discard block |
||
45 | 45 | } |
46 | 46 | }); |
47 | 47 | |
48 | -Route::post('scaffolder/generate-and-execute', function (Request $request) |
|
48 | +Route::post('scaffolder/generate-and-execute', function(Request $request) |
|
49 | 49 | { |
50 | 50 | $models = $request->only('models'); |
51 | 51 | |
52 | - array_walk_recursive($models, function (&$item) |
|
52 | + array_walk_recursive($models, function(&$item) |
|
53 | 53 | { |
54 | 54 | if ($item == 'true') $item = true; |
55 | 55 | elseif ($item == 'false') $item = false; |
@@ -27,8 +27,11 @@ discard block |
||
27 | 27 | |
28 | 28 | array_walk_recursive($models, function (&$item) |
29 | 29 | { |
30 | - if ($item == 'true') $item = true; |
|
31 | - elseif ($item == 'false') $item = false; |
|
30 | + if ($item == 'true') { |
|
31 | + $item = true; |
|
32 | + } elseif ($item == 'false') { |
|
33 | + $item = false; |
|
34 | + } |
|
32 | 35 | }); |
33 | 36 | |
34 | 37 | // Generate app.json |
@@ -51,8 +54,11 @@ discard block |
||
51 | 54 | |
52 | 55 | array_walk_recursive($models, function (&$item) |
53 | 56 | { |
54 | - if ($item == 'true') $item = true; |
|
55 | - elseif ($item == 'false') $item = false; |
|
57 | + if ($item == 'true') { |
|
58 | + $item = true; |
|
59 | + } elseif ($item == 'false') { |
|
60 | + $item = false; |
|
61 | + } |
|
56 | 62 | }); |
57 | 63 | |
58 | 64 | // Generate app.json |