check()) { throw new NotFoundHttpException; } $transactionType = self::where('type', $type)->first(); if (!is_null($transactionType)) { return $transactionType; } throw new NotFoundHttpException; } /** * @return bool */ public function isDeposit() { return $this->type === TransactionType::DEPOSIT; } /** * @return bool */ public function isOpeningBalance() { return $this->type === TransactionType::OPENING_BALANCE; } /** * @return bool */ public function isTransfer() { return $this->type === TransactionType::TRANSFER; } /** * @return bool */ public function isWithdrawal() { return $this->type === TransactionType::WITHDRAWAL; } /** * * @return \Illuminate\Database\Eloquent\Relations\HasMany */ public function transactionJournals() { return $this->hasMany('FireflyIII\Models\TransactionJournal'); } }