. */ declare(strict_types=1); namespace FireflyIII\Http\Requests; use Carbon\Carbon; use FireflyIII\Support\Request\ChecksLogin; use Illuminate\Foundation\Http\FormRequest; /** * Class SelectTransactionsRequest. * * @codeCoverageIgnore */ class SelectTransactionsRequest extends FormRequest { use ChecksLogin; /** * Rules for this request. * * @return array */ public function rules(): array { // fixed /** @var Carbon $sessionFirst */ $sessionFirst = clone session('first'); $first = $sessionFirst->subDay()->format('Y-m-d'); $today = Carbon::now()->addDay()->format('Y-m-d'); return [ 'start' => 'required|date|after:' . $first, 'end' => 'required|date|before:' . $today, 'accounts' => 'required', 'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts', ]; } }