Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
CRAP | |
0.00% |
0 / 1 |
| ManageServiceRequest | |
0.00% |
0 / 7 |
|
0.00% |
0 / 2 |
12 | |
0.00% |
0 / 1 |
| authorize | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
| rules | |
0.00% |
0 / 6 |
|
0.00% |
0 / 1 |
6 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Requests; |
| 4 | |
| 5 | use ArondeParon\RequestSanitizer\Sanitizers\FilterVars; |
| 6 | use ArondeParon\RequestSanitizer\Traits\SanitizesInputs; |
| 7 | use Illuminate\Foundation\Http\FormRequest; |
| 8 | |
| 9 | class ManageServiceRequest 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 | 'brand_id' => 'required|exists:brands,id' |
| 47 | ]; |
| 48 | } |
| 49 | return []; |
| 50 | } |
| 51 | } |