2024-04-08 16:49:48 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Requests\Api;
|
|
|
|
|
|
|
|
|
|
use Carbon\Carbon;
|
|
|
|
|
use Illuminate\Foundation\Http\FormRequest;
|
|
|
|
|
|
|
|
|
|
class GetStatsRequest extends FormRequest
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Prepare the data for validation.
|
|
|
|
|
*
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
protected function prepareForValidation(): void
|
|
|
|
|
{
|
|
|
|
|
$this->merge([
|
2026-02-12 16:09:21 +01:00
|
|
|
'period' => $this->input('period') ? $this->input('period') : 'day',
|
2024-04-08 16:49:48 +02:00
|
|
|
'start' => $this->input('start') ? Carbon::create($this->input('start')) : now()->modify('-1 year'),
|
|
|
|
|
'end' => $this->input('end') ? Carbon::create($this->input('end')) : now(),
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get the validation rules that apply to the request.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function rules(): array
|
|
|
|
|
{
|
|
|
|
|
return [];
|
|
|
|
|
}
|
|
|
|
|
}
|