. */ declare(strict_types=1); namespace FireflyIII\Support\Binder; use FireflyIII\Models\TransactionJournal; use Illuminate\Routing\Route; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * Class Date. */ class UnfinishedJournal implements BinderInterface { /** * @param string $value * @param Route $route * * @return TransactionJournal * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value, Route $route): TransactionJournal { if (auth()->check()) { $journal = auth()->user()->transactionJournals()->where('transaction_journals.id', $value) ->leftJoin('transaction_types', 'transaction_types.id', '=', 'transaction_journals.transaction_type_id') ->where('completed', 0) ->where('user_id', auth()->user()->id)->first(['transaction_journals.*']); if (null !== $journal) { return $journal; } } throw new NotFoundHttpException; } }