Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| ManageServiceRequest | n/a |
0 / 0 |
n/a |
0 / 0 |
3 | n/a |
0 / 0 |
|||
| authorize | n/a |
0 / 0 |
n/a |
0 / 0 |
1 | |||||
| rules | n/a |
0 / 0 |
n/a |
0 / 0 |
2 | |||||
| 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 | /** |
| 10 | * @codeCoverageIgnore |
| 11 | */ |
| 12 | class ManageServiceRequest 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 | 'brand_id' => 'required|exists:brands,id' |
| 49 | ]; |
| 50 | } |
| 51 | return []; |
| 52 | } |
| 53 | } |