65 lines
1.8 KiB
PHP
65 lines
1.8 KiB
PHP
<?php
|
|
|
|
namespace App\Http\Requests\Fo;
|
|
|
|
use App\Http\Requests\Fo\Customers\CreateAccountRequest;
|
|
use Illuminate\Support\Arr;
|
|
use Illuminate\Support\Facades\Gate;
|
|
|
|
class SubmitWinningProofRequest extends CreateAccountRequest
|
|
{
|
|
/**
|
|
* Determine if the user is authorized to make this request.
|
|
*
|
|
* @return boolean
|
|
*/
|
|
public function authorize(): bool
|
|
{
|
|
return auth('frontend')->check() and
|
|
Gate::check('submitProof', $this->route('participation'));
|
|
}
|
|
|
|
/**
|
|
* Get the validation rules that apply to the request.
|
|
*
|
|
* @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
|
|
*/
|
|
public function rules(): array
|
|
{
|
|
return \array_merge(Arr::only(
|
|
parent::rules(),
|
|
[
|
|
'lastname',
|
|
'firstname',
|
|
'address',
|
|
'address2',
|
|
'postal_code',
|
|
'city',
|
|
'country'
|
|
]
|
|
), [
|
|
'phone' => 'required|phone:FR',
|
|
// * Min 10 KB, Max 2MB
|
|
'sticker' => 'required|mimes:jpeg,jpg,png,pdf|min:10|max:2048',
|
|
'ticket' => 'required|mimes:jpeg,jpg,png,pdf|min:10|max:2048',
|
|
'barcode' => 'required|mimes:jpeg,jpg,png,pdf|min:10|max:2048',
|
|
]);
|
|
}
|
|
|
|
/**
|
|
* Get custom attributes for validator errors.
|
|
*
|
|
* @return array
|
|
*/
|
|
public function attributes(): array
|
|
{
|
|
return \array_merge(
|
|
parent::attributes(),
|
|
[
|
|
'sticker' => trans('validation.custom.sticker'),
|
|
'ticket' => trans('validation.custom.ticket'),
|
|
'barcode' => trans('validation.custom.barcode'),
|
|
]
|
|
);
|
|
}
|
|
}
|