Code Coverage |
||||||||||
Classes and Traits |
Functions and Methods |
Lines |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| CustomerExport | 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 | |
| 3 | namespace App\Http\Requests; |
| 4 | |
| 5 | use App\Enums\CustomerExportType; |
| 6 | use Illuminate\Foundation\Http\FormRequest; |
| 7 | |
| 8 | /** |
| 9 | * @codeCoverageIgnore |
| 10 | */ |
| 11 | class CustomerExport extends FormRequest |
| 12 | { |
| 13 | /** |
| 14 | * Determine if the user is authorized to make this request. |
| 15 | * |
| 16 | * @return boolean |
| 17 | */ |
| 18 | public function authorize() |
| 19 | { |
| 20 | return auth()->check(); |
| 21 | } |
| 22 | |
| 23 | /** |
| 24 | * Get the validation rules that apply to the request. |
| 25 | * |
| 26 | * @return array |
| 27 | */ |
| 28 | public function rules() |
| 29 | { |
| 30 | return [ |
| 31 | 'brand' => 'required|numeric|exists:brands,id', |
| 32 | 'export_type' => [ |
| 33 | 'required', |
| 34 | 'numeric', |
| 35 | // phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed |
| 36 | function ($attribute, $value, $fail) { |
| 37 | if (!\in_array($value, CustomerExportType::values())) { |
| 38 | $fail(trans('Le type d\'export invalide')); |
| 39 | } |
| 40 | } |
| 41 | ] |
| 42 | ]; |
| 43 | } |
| 44 | } |