Code Coverage
 
Classes and Traits
Functions and Methods
Lines
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
ManageBrandRequest
n/a
0 / 0
n/a
0 / 0
3
n/a
0 / 0
 authorize
n/a
0 / 0
1
n/a
0 / 0
 rules
n/a
0 / 0
2
n/a
0 / 0
1<?php
2
3namespace App\Http\Requests;
4
5use ArondeParon\RequestSanitizer\Sanitizers\FilterVars;
6use ArondeParon\RequestSanitizer\Traits\SanitizesInputs;
7use Illuminate\Foundation\Http\FormRequest;
8
9/**
10 * @codeCoverageIgnore
11 */
12class ManageBrandRequest extends FormRequest
13{
14    use SanitizesInputs;
15
16    /**
17     * Using these sanitizers before proceeding the request
18     * @var array
19     */
20    protected $sanitizers = [
21        'name' => [
22            FilterVars::class => [
23                'filter' => FILTER_SANITIZE_STRING
24            ]
25        ],
26    ];
27
28    /**
29     * Determine if the user is authorized to make this request.
30     *
31     * @return boolean
32     */
33    public function authorize()
34    {
35        return auth()->check();
36    }
37
38    /**
39     * Get the validation rules that apply to the request.
40     *
41     * @return array
42     */
43    public function rules()
44    {
45        if ($this->isMethod('post')) {
46            return [
47                'name' => 'required|string|min:5|max:255'
48            ];
49        }
50        return [];
51    }
52}