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