'date', 'updated_at' => 'date', 'deleted_at' => 'date', ]; protected $dates = ['created_at', 'updated_at', 'deleted_at']; /** * @param string $type * * @return Model|null|static */ public static function routeBinder(string $type) { if (!auth()->check()) { throw new NotFoundHttpException; } $transactionType = self::where('type', ucfirst($type))->first(); if (!is_null($transactionType)) { return $transactionType; } throw new NotFoundHttpException; } /** * @return bool */ public function isDeposit() { return $this->type === self::DEPOSIT; } /** * @return bool */ public function isOpeningBalance() { return $this->type === self::OPENING_BALANCE; } /** * @return bool */ public function isTransfer() { return $this->type === self::TRANSFER; } /** * @return bool */ public function isWithdrawal() { return $this->type === self::WITHDRAWAL; } /** * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function transactionJournals() { return $this->hasMany('FireflyIII\Models\TransactionJournal'); } }