36 lines
723 B
PHP
36 lines
723 B
PHP
|
|
<?php
|
||
|
|
|
||
|
|
namespace App\Http\Requests\Bo;
|
||
|
|
|
||
|
|
use Illuminate\Foundation\Http\FormRequest;
|
||
|
|
use Illuminate\Support\Carbon;
|
||
|
|
|
||
|
|
class AjaxCreateBasketRequest extends FormRequest
|
||
|
|
{
|
||
|
|
/**
|
||
|
|
* Determine if the user is authorized to make this request.
|
||
|
|
*
|
||
|
|
* @return boolean
|
||
|
|
*/
|
||
|
|
public function authorize()
|
||
|
|
{
|
||
|
|
$this->merge([
|
||
|
|
'title' => $this->title ??
|
||
|
|
sprintf('Panier du %s', Carbon::now()->format('d/m/Y'))
|
||
|
|
]);
|
||
|
|
return auth()->check();
|
||
|
|
}
|
||
|
|
|
||
|
|
/**
|
||
|
|
* Get the validation rules that apply to the request.
|
||
|
|
*
|
||
|
|
* @return array
|
||
|
|
*/
|
||
|
|
public function rules()
|
||
|
|
{
|
||
|
|
return [
|
||
|
|
'title' => 'required|min:1|max:255'
|
||
|
|
];
|
||
|
|
}
|
||
|
|
}
|