getCarbonDate('date'); } public function getRate(): string { return (string) $this->get('rate'); } public function getFromCurrency(): TransactionCurrency { return TransactionCurrency::where('code', $this->get('from'))->first(); } public function getToCurrency(): TransactionCurrency { return TransactionCurrency::where('code', $this->get('to'))->first(); } /** * The rules that the incoming request must be matched against. */ public function rules(): array { return [ 'date' => 'required|date|after:1900-01-01|before:2099-12-31', 'rate' => 'required|numeric|gt:0', 'from' => 'required|exists:transaction_currencies,code', 'to' => 'required|exists:transaction_currencies,code', ]; } }