Completed
Push — develop ( 77d046...2d0273 )
by Abdelrahman
01:14
created

AttributeFormRequest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 2
lcom 0
cbo 2
dl 0
loc 29
rs 10
c 0
b 0
f 0

2 Methods

Rating   Name   Duplication   Size   Complexity  
A authorize() 0 4 1
A rules() 0 9 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Cortex\Attributes\Http\Requests\Adminarea;
6
7
use Rinvex\Support\Traits\Escaper;
8
use Illuminate\Foundation\Http\FormRequest;
9
10
class AttributeFormRequest extends FormRequest
11
{
12
    use Escaper;
13
14
    /**
15
     * Determine if the user is authorized to make this request.
16
     *
17
     * @return bool
18
     */
19
    public function authorize(): bool
20
    {
21
        return true;
22
    }
23
24
    /**
25
     * Get the validation rules that apply to the request.
26
     *
27
     * @return array
28
     */
29
    public function rules(): array
30
    {
31
        $attribute = $this->route('attribute') ?? app('rinvex.attributes.attribute');
32
        $attribute->updateRulesUniques();
33
        $rules = $attribute->getRules();
34
        $rules['entities'] = 'nullable|array';
35
36
        return $rules;
37
    }
38
}
39