60 lines
1.4 KiB
PHP
60 lines
1.4 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Club\Bourse;
|
|
|
|
use App\Enums\Departaimants\DepartaimantCollectionType;
|
|
use App\Enums\Departaimants\DepartaimantCurrent;
|
|
use App\Enums\Departaimants\DepartaimantStatus;
|
|
use App\Enums\Departaimants\DepartaimantVintage;
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
use Illuminate\Support\Facades\Auth;
|
|
use Illuminate\Validation\Rule;
|
|
|
|
abstract class CustomerCollectionRequest extends FormRequest
|
|
{
|
|
/**
|
|
* populated in rules function
|
|
*
|
|
* @var array<string|integer,string>
|
|
*/
|
|
protected $maps = [
|
|
DepartaimantCollectionType::current->value => DepartaimantCurrent::class,
|
|
DepartaimantCollectionType::vintage->value => DepartaimantVintage::class
|
|
];
|
|
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return Auth::guard('club')->check();
|
|
}
|
|
|
|
/**
|
|
* Prepare the data for validation.
|
|
*
|
|
* @return void
|
|
*/
|
|
public function prepareForValidation(): void
|
|
{
|
|
$this->merge([
|
|
'maps' => $this->maps
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return [
|
|
'state' => [
|
|
Rule::enum(DepartaimantStatus::class)
|
|
]
|
|
];
|
|
}
|
|
}
|