. */ declare(strict_types=1); namespace FireflyIII\Http\Requests; use Carbon\Carbon; /** * @codeCoverageIgnore * Class ExportFormRequest. */ class SelectTransactionsRequest extends Request { /** * @return bool */ public function authorize() { // Only allow logged in users return auth()->check(); } /** * @return array */ public function rules() { // fixed $sessionFirst = clone session('first'); $first = $sessionFirst->subDay()->format('Y-m-d'); $today = Carbon::create()->addDay()->format('Y-m-d'); return [ 'start_date' => 'required|date|after:' . $first, 'end_date' => 'required|date|before:' . $today, 'accounts' => 'required', 'accounts.*' => 'required|exists:accounts,id|belongsToUser:accounts', ]; } }