mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 23:28:20 +00:00
Updated code coverage, improved binder code.
This commit is contained in:
@@ -23,6 +23,7 @@ declare(strict_types=1);
|
||||
namespace FireflyIII\Support\Binder;
|
||||
|
||||
use FireflyIII\Models\TransactionCurrency;
|
||||
use Illuminate\Routing\Route;
|
||||
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
|
||||
/**
|
||||
@@ -31,15 +32,15 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
|
||||
class CurrencyCode implements BinderInterface
|
||||
{
|
||||
/**
|
||||
* @param $value
|
||||
* @param $route
|
||||
* @param string $value
|
||||
* @param Route $route
|
||||
*
|
||||
* @return mixed
|
||||
* @return TransactionCurrency
|
||||
*/
|
||||
public static function routeBinder($value, $route)
|
||||
public static function routeBinder(string $value, Route $route): TransactionCurrency
|
||||
{
|
||||
if (auth()->check()) {
|
||||
$currency = TransactionCurrency::where('code', $value)->first();
|
||||
$currency = TransactionCurrency::where('code', trim($value))->first();
|
||||
if (null !== $currency) {
|
||||
return $currency;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user