Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
CRAP
100.00% covered (success)
100.00%
1 / 1
AdminUpsertDomainRequest
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
100.00% covered (success)
100.00%
1 / 1
 rules
100.00% covered (success)
100.00%
10 / 10
100.00% covered (success)
100.00%
1 / 1
1
1<?php
2
3namespace App\Http\Requests\v2\UserFieldInjection;
4
5use App\Http\Requests\v2\Parameter\Concerns\AuthorizesVengresoAdmin;
6use Illuminate\Foundation\Http\FormRequest;
7
8/**
9 * Admin request for upserting a domain entry in a user's field injection config.
10 *
11 * @property array<array{selector: string, is_inside_shadow_dom?: bool, inside_of?: string, not_inside_of?: string, has_parent_selector?: string, icon_offset_bottom?: int}> $fields The field configurations for this domain
12 */
13class AdminUpsertDomainRequest extends FormRequest
14{
15    use AuthorizesVengresoAdmin;
16
17    /**
18     * Get the validation rules that apply to the request.
19     *
20     * @return array<string, mixed>
21     */
22    public function rules(): array
23    {
24        return [
25            'fields' => ['required', 'array', 'min:1'],
26            'fields.*' => ['array'],
27            'fields.*.selector' => ['required', 'string'],
28            'fields.*.is_inside_shadow_dom' => ['sometimes', 'boolean'],
29            'fields.*.inside_of' => ['sometimes', 'string'],
30            'fields.*.not_inside_of' => ['sometimes', 'string'],
31            'fields.*.has_parent_selector' => ['sometimes', 'string'],
32            'fields.*.icon_offset_bottom' => ['sometimes', 'integer'],
33        ];
34    }
35}