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