. */ declare(strict_types=1); namespace FireflyIII\Support\Binder; use FireflyIII\Models\TransactionCurrency; use Illuminate\Routing\Route; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * Class CurrencyCode. */ class CurrencyCode implements BinderInterface { /** * @param string $value * @param Route $route * * @return TransactionCurrency */ public static function routeBinder(string $value, Route $route): TransactionCurrency { if (auth()->check()) { $currency = TransactionCurrency::where('code', trim($value))->first(); if (null !== $currency) { return $currency; } } throw new NotFoundHttpException; } }