. */ declare(strict_types=1); namespace FireflyIII\Http\Requests; use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; /** * Class BillStoreRequest. */ class BillStoreRequest extends FormRequest { use ConvertsDataTypes, ChecksLogin; /** * Returns the data required by the controller. * * @return array */ public function getBillData(): array { return [ 'name' => $this->string('name'), 'amount_min' => $this->string('amount_min'), 'currency_id' => $this->integer('transaction_currency_id'), 'currency_code' => '', 'amount_max' => $this->string('amount_max'), 'date' => $this->date('date'), 'repeat_freq' => $this->string('repeat_freq'), 'skip' => $this->integer('skip'), 'notes' => $this->nlString('notes'), 'active' => $this->boolean('active'), 'object_group_title' => $this->string('object_group'), ]; } /** * Rules for this request. * * @return array */ public function rules(): array { return [ 'name' => 'required|between:1,255|uniqueObjectForUser:bills,name', 'amount_min' => 'required|numeric|gt:0|max:1000000000', 'amount_max' => 'required|numeric|gt:0|max:1000000000', 'transaction_currency_id' => 'required|exists:transaction_currencies,id', 'date' => 'required|date', 'repeat_freq' => 'required|in:weekly,monthly,quarterly,half-year,yearly', 'skip' => 'required|between:0,31', 'active' => 'boolean', ]; } }