. */ declare(strict_types=1); namespace FireflyIII\Support\Binder; use FireflyIII\Exceptions\FireflyException; use FireflyIII\Models\TransactionCurrency; use FireflyIII\Support\Facades\Amount; use Illuminate\Routing\Route; use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; /** * Class CurrencyCode. */ class CurrencyCode implements BinderInterface { /** * @throws NotFoundHttpException */ public static function routeBinder(string $value, Route $route): TransactionCurrency { if (auth()->check()) { try { $currency = Amount::getTransactionCurrencyByCode(trim($value)); } catch (FireflyException) { throw new NotFoundHttpException(); } return $currency; } throw new NotFoundHttpException(); } }