ldc-crm/app/Http/Requests/CustomerExport.php
Alexis Gousseau 303834bbca
Crm V4
- Make all tests pass Client (V4),CRMV2,CRMV4
- Simplify client submodule path
- Move App_url to .env.testing
2023-10-06 16:37:29 +02:00

41 lines
1 KiB
PHP

<?php
namespace App\Http\Requests;
use App\Enums\CustomerExportType;
use Illuminate\Foundation\Http\FormRequest;
class CustomerExport extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return boolean
*/
public function authorize(): bool
{
return auth()->check();
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules(): array
{
return [
'brand' => 'required|numeric|exists:brands,id',
'export_type' => [
'required',
'numeric',
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
function ($attribute, $value, $fail) {
if (!\in_array($value, CustomerExportType::toValues())) {
$fail(trans('Le type d\'export invalide'));
}
}
]
];
}
}