. */ declare(strict_types=1); namespace FireflyIII\Http\Requests; use FireflyIII\Support\Request\ChecksLogin; use FireflyIII\Support\Request\ConvertsDataTypes; use Illuminate\Foundation\Http\FormRequest; /** * Class PiggyBankStoreRequest. */ class PiggyBankStoreRequest extends FormRequest { use ChecksLogin; use ConvertsDataTypes; /** * Returns the data required by the controller. */ public function getPiggyBankData(): array { return [ 'name' => $this->convertString('name'), 'startdate' => $this->getCarbonDate('startdate'), 'account_id' => $this->convertInteger('account_id'), 'targetamount' => $this->convertString('targetamount'), 'targetdate' => $this->getCarbonDate('targetdate'), 'notes' => $this->stringWithNewlines('notes'), 'object_group_title' => $this->convertString('object_group'), ]; } /** * Rules for this request. */ public function rules(): array { return [ 'name' => 'required|between:1,255|uniquePiggyBankForUser', 'account_id' => 'required|belongsToUser:accounts', 'targetamount' => 'nullable|numeric|max:1000000000', 'startdate' => 'date', 'targetdate' => 'date|nullable', 'order' => 'integer|min:1', 'object_group' => 'min:0|max:255', ]; } }