-
-
Notifications
You must be signed in to change notification settings - Fork 32
Expand file tree
/
Copy pathFormBlockLogicRequest.php
More file actions
50 lines (45 loc) · 1.84 KB
/
FormBlockLogicRequest.php
File metadata and controls
50 lines (45 loc) · 1.84 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class FormBlockLogicRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*/
public function authorize(): bool
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
*/
public function rules(): array
{
return [
'name' => 'required|string|max:255',
'conditions' => 'required|array',
'conditions.*.source' => 'required|string',
'conditions.*.operator' => 'required|string|in:equals,equalsNot,contains,containsNot,isLowerThan,isGreaterThan',
'conditions.*.value' => 'required|string',
'conditions.*.chainOperator' => 'required|string|in:and,or',
'action' => 'required|string|in:hide,show,goto',
'action_payload' => 'nullable|string',
'evaluate' => 'required|string|in:before,after',
];
}
public function messages()
{
return [
'name.required' => 'The name is required.',
'conditions.required' => 'At least one condition is required.',
'conditions.*.source.required' => 'The source block for your #:position condition is required.',
'conditions.*.value.required' => 'The value for your #:position condition is required.',
'conditions.*.operator.required' => 'The operator for the #:position condition is required.',
'conditions.*.chainOperator.required' => 'The chain operator for the #:position condition is required.',
'action.required' => 'The action is required.',
'evaluate.required' => 'The evaluate is required.',
];
}
}