Skip to content

Commit d2c9ed3

Browse files
DaveXo9DavidStyleCIBot
authored
Added renderer column to custom fields table (#102)
* Added renderer column to custom fields table * Apply fixes from StyleCI * Added render to request files * Apply fixes from StyleCI --------- Co-authored-by: David <david.katalinic@asseco-see.hr> Co-authored-by: StyleCI Bot <bot@styleci.io>
1 parent b48891a commit d2c9ed3

8 files changed

+39
-2
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?php
2+
3+
use Illuminate\Database\Migrations\Migration;
4+
use Illuminate\Database\Schema\Blueprint;
5+
use Illuminate\Support\Facades\Schema;
6+
7+
class AddRendererToCustomFieldsTable extends Migration
8+
{
9+
/**
10+
* Run the migrations.
11+
*
12+
* @return void
13+
*/
14+
public function up()
15+
{
16+
Schema::table('custom_fields', function (Blueprint $table) {
17+
$table->text('renderer')->nullable();
18+
});
19+
}
20+
21+
/**
22+
* Reverse the migrations.
23+
*
24+
* @return void
25+
*/
26+
public function down()
27+
{
28+
Schema::table('custom_fields', function (Blueprint $table) {
29+
$table->dropColumn('renderer');
30+
});
31+
}
32+
}

src/App/Http/Controllers/PlainCustomFieldController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(CustomField $customField)
3333
* @param string|null $type
3434
* @return JsonResponse
3535
*/
36-
public function index(string $type = null): JsonResponse
36+
public function index(?string $type = null): JsonResponse
3737
{
3838
return response()->json($this->customField::plain($type)->get());
3939
}

src/App/Http/Requests/CustomFieldCreateRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function rules()
4747
'validation_id' => 'nullable|exists:custom_field_validations,id',
4848
'group' => 'nullable|string',
4949
'order' => 'nullable|integer',
50+
'renderer' => 'nullable|string',
5051
];
5152
}
5253

src/App/Http/Requests/CustomFieldUpdateRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ public function rules()
5050
'validation_id' => 'nullable|exists:custom_field_validations,id',
5151
'group' => 'nullable|string',
5252
'order' => 'nullable|integer',
53+
'renderer' => 'nullable|string',
5354
];
5455

5556
return Arr::except($rules, self::LOCKED_FOR_EDITING);

src/App/Http/Requests/PlainCustomFieldRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function rules()
4444
'validation_id' => 'nullable|exists:custom_field_validations',
4545
'group' => 'nullable|string',
4646
'order' => 'nullable|integer',
47+
'renderer' => 'nullable|string',
4748
];
4849
}
4950

src/App/Http/Requests/RemoteCustomFieldRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function rules()
4444
'validation_id' => 'nullable|exists:custom_field_validations',
4545
'group' => 'nullable|string',
4646
'order' => 'nullable|integer',
47+
'renderer' => 'nullable|string',
4748
'remote' => 'required|array',
4849
'remote.url' => 'required|url',
4950
'remote.method' => 'required|in:GET,POST,PUT',

src/App/Http/Requests/SelectionCustomFieldRequest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public function rules()
4444
'validation_id' => 'nullable|exists:custom_field_validations',
4545
'group' => 'nullable|string',
4646
'order' => 'nullable|integer',
47+
'renderer' => 'nullable|string',
4748
'selection' => 'array',
4849
'selection.multiselect' => 'boolean',
4950
'values' => 'array',

src/App/Models/CustomField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function selectable(): MorphTo
8080
return $this->morphTo();
8181
}
8282

83-
public function scopePlain(Builder $query, string $subType = null): Builder
83+
public function scopePlain(Builder $query, ?string $subType = null): Builder
8484
{
8585
/** @var PlainType $plainType */
8686
$plainType = app(PlainType::class);

0 commit comments

Comments
 (0)