FormfieldRequest::authorize()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace MedianetDev\BackpackForm\Http\Requests;
4
5
use Illuminate\Foundation\Http\FormRequest;
6
7
class FormfieldRequest extends FormRequest
8
{
9
    public function authorize()
10
    {
11
        return true;
12
    }
13
14
    public function rules()
15
    {
16
        $locale = app()->getLocale();
0 ignored issues
show
introduced by
The method getLocale() does not exist on Illuminate\Container\Container. Are you sure you never get this type here, but always one of the subclasses? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

16
        $locale = app()->/** @scrutinizer ignore-call */ getLocale();
Loading history...
17
        return [
18
          //  'key' => 'required|string|unique:med_form_fields,key',
19
            'form_id' => 'required|exists:med_forms,id',
20
            'form_step_id' => 'required|exists:med_form_steps,id',
21
            'type' => 'required|string|in:textfield,textarea,number,password,checkbox,selectboxes,select,radio,button,email,url,phoneNumber,address,datetime,day,time,currency,signature,file,content,columns,fieldset,panel,table,tabs,well,hidden',
22
            'is_required' => 'boolean',
23
            'is_active' => 'boolean',
24
            'order' => 'nullable|integer|min:0',
25
            'formio_component' => 'nullable|json',
26
            'validation_rules' => 'nullable|json',
27
            "{$locale}.label" => 'required|string|max:255',
28
            "{$locale}.placeholder" => 'nullable|string|max:255',
29
        ];
30
    }
31
}
32