. */ declare(strict_types=1); namespace FireflyIII\Support\Binder; use Illuminate\Routing\Route; use Illuminate\Support\Collection; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * Class JournalList. */ class JournalList implements BinderInterface { /** * @param string $value * @param Route $route * * @return mixed * @throws \Symfony\Component\HttpKernel\Exception\NotFoundHttpException */ public static function routeBinder(string $value, Route $route): Collection { if (auth()->check()) { $list = array_unique(array_map('\intval', explode(',', $value))); if (0 === \count($list)) { throw new NotFoundHttpException; // @codeCoverageIgnore } /** @var \Illuminate\Support\Collection $collection */ $collection = auth()->user()->transactionJournals() ->whereIn('transaction_journals.id', $list) ->where('transaction_journals.completed', 1) ->get(['transaction_journals.*']); if ($collection->count() > 0) { return $collection; } } throw new NotFoundHttpException; } }