@@ -17,7 +17,7 @@ |
||
17 | 17 | * If the entity is supposed to create a |
18 | 18 | * table in the Database, it will do |
19 | 19 | * It won't do anything otherwise |
20 | - * @param Events $event |
|
20 | + * @param EntityWasCreated $event |
|
21 | 21 | * @return void |
22 | 22 | */ |
23 | 23 | public function handle(EntityWasCreated $event) |
@@ -23,7 +23,7 @@ |
||
23 | 23 | public function handle(EntityWasCreated $event) |
24 | 24 | { |
25 | 25 | if ((bool) $event->entity->create_table) { |
26 | - Schema::create($event->entity->table_name, function ($table) { |
|
26 | + Schema::create($event->entity->table_name, function($table) { |
|
27 | 27 | $table->increments('id'); |
28 | 28 | $table->timestamps(); |
29 | 29 | $table->softDeletes(); |
@@ -28,7 +28,6 @@ |
||
28 | 28 | /** |
29 | 29 | * CreateEntryCommand constructor. |
30 | 30 | * @param $entity |
31 | - * @param array $data |
|
32 | 31 | */ |
33 | 32 | public function __construct($entity, $entry_id, array $input) |
34 | 33 | { |
@@ -15,7 +15,7 @@ |
||
15 | 15 | /** |
16 | 16 | * Handle the creation of the Field in the Database |
17 | 17 | * @param $command |
18 | - * @return static |
|
18 | + * @return FieldModel |
|
19 | 19 | */ |
20 | 20 | public function handle($command) |
21 | 21 | { |
@@ -10,7 +10,7 @@ |
||
10 | 10 | /** |
11 | 11 | * Once the field has been edited in the DB Record |
12 | 12 | * The column in the entity table will be edited. |
13 | - * @param FieldWasCreated $event |
|
13 | + * @param FieldWasEdited $event |
|
14 | 14 | */ |
15 | 15 | public function handle(FieldWasEdited $event) |
16 | 16 | { |
@@ -17,12 +17,12 @@ |
||
17 | 17 | $field = $event->field; |
18 | 18 | $rename = $event->rename; |
19 | 19 | $oldSlug = $event->oldSlug; |
20 | - Schema::table($event->field->entity->getTableName(), function ($table) use ($field, $rename, $oldSlug) { |
|
20 | + Schema::table($event->field->entity->getTableName(), function($table) use ($field, $rename, $oldSlug) { |
|
21 | 21 | if ($rename) { |
22 | 22 | $table->renameColumn($oldSlug, $field->slug); |
23 | 23 | } |
24 | 24 | }); |
25 | - Schema::table($event->field->entity->getTableName(), function ($table) use ($field) { |
|
25 | + Schema::table($event->field->entity->getTableName(), function($table) use ($field) { |
|
26 | 26 | $table->{$field->getType()->getColumnType()}($field->slug)->nullable()->default($field->default)->change(); |
27 | 27 | }); |
28 | 28 | } |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Hechoenlaravel\JarvisFoundation\Http\Controllers\Core; |
4 | 4 | |
5 | 5 | use Illuminate\Http\Request; |
6 | -use Hechoenlaravel\JarvisFoundation\Http\Requests; |
|
7 | 6 | use Hechoenlaravel\JarvisFoundation\Http\Controllers\Controller; |
8 | 7 | use Joselfonseca\LaravelApiTools\Traits\ResponderTrait; |
9 | 8 | use Hechoenlaravel\JarvisFoundation\Traits\EntityManager; |
@@ -61,7 +61,7 @@ discard block |
||
61 | 61 | $data = $request->all(); |
62 | 62 | $data['entity_id'] = $id; |
63 | 63 | $field = $this->generateField($data); |
64 | - return $this->response->item($field, new FieldTransformer(), [], function ($resource, $fractal) use ($data) { |
|
64 | + return $this->response->item($field, new FieldTransformer(), [], function($resource, $fractal) use ($data) { |
|
65 | 65 | $resource->setMetaValue('return_url', $data['returnUrl']); |
66 | 66 | }); |
67 | 67 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | $data = $request->all(); |
90 | 90 | $data['id'] = $fields; |
91 | 91 | $field = $this->editField($data); |
92 | - return $this->response->item($field, new FieldTransformer(), [], function ($resource, $fractal) use ($data) { |
|
92 | + return $this->response->item($field, new FieldTransformer(), [], function($resource, $fractal) use ($data) { |
|
93 | 93 | $resource->setMetaValue('return_url', $data['returnUrl']); |
94 | 94 | }); |
95 | 95 | } |
@@ -127,7 +127,7 @@ discard block |
||
127 | 127 | { |
128 | 128 | $fieldTypes = app('field.types'); |
129 | 129 | if (!isset($fieldTypes->types[$type])) { |
130 | - throw new \NotAcceptableHttpException('El field type ' . $type . ' no esta registrado'); |
|
130 | + throw new \NotAcceptableHttpException('El field type '.$type.' no esta registrado'); |
|
131 | 131 | } |
132 | 132 | $this->fieldType = app($fieldTypes->types[$type]); |
133 | 133 | } |
@@ -3,7 +3,6 @@ |
||
3 | 3 | namespace Hechoenlaravel\JarvisFoundation\Http\Controllers\Core; |
4 | 4 | |
5 | 5 | use Hechoenlaravel\JarvisFoundation\Flows\Transition; |
6 | -use Illuminate\Http\Request; |
|
7 | 6 | use Hechoenlaravel\JarvisFoundation\Flows\Flow; |
8 | 7 | use Hechoenlaravel\JarvisFoundation\Flows\Step; |
9 | 8 | use Hechoenlaravel\JarvisFoundation\Http\Requests; |
@@ -49,7 +49,7 @@ |
||
49 | 49 | protected function setRulesForField($field) |
50 | 50 | { |
51 | 51 | $this->rules[$field->slug] = []; |
52 | - if ((bool)$field->required === true) { |
|
52 | + if ((bool) $field->required === true) { |
|
53 | 53 | array_push($this->rules[$field->slug], 'required'); |
54 | 54 | } |
55 | 55 | // Import the validation rules from the fieldtype Class |
@@ -21,7 +21,7 @@ |
||
21 | 21 | { |
22 | 22 | $field = $event->field; |
23 | 23 | if ($field->create_field) { |
24 | - Schema::table($event->field->entity->getTableName(), function ($table) use ($field) { |
|
24 | + Schema::table($event->field->entity->getTableName(), function($table) use ($field) { |
|
25 | 25 | $table->{$field->getType()->getColumnType()}($field->slug)->nullable()->default($field->default); |
26 | 26 | }); |
27 | 27 | event(new FieldWasCreatedInDb($field)); |
@@ -12,7 +12,7 @@ |
||
12 | 12 | { |
13 | 13 | $field = $event->field; |
14 | 14 | $entity = EntityModel::find($field['entity_id']); |
15 | - Schema::table($entity->getTableName(), function ($table) use ($field) { |
|
15 | + Schema::table($entity->getTableName(), function($table) use ($field) { |
|
16 | 16 | $table->dropColumn($field['slug']); |
17 | 17 | }); |
18 | 18 | } |