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