fix some bugs

This commit is contained in:
2026-07-18 15:04:08 +03:30
parent 4c7e4fdfde
commit eedde65be6
4 changed files with 94 additions and 29 deletions
@@ -9,6 +9,7 @@ use App\Models\Customer;
use App\Models\Order;
use App\Models\Price;
use App\Models\Setting;
use App\Services\WalletBalanceService;
use Illuminate\Http\Request;
use Symfony\Component\HttpKernel\Exception\UnprocessableEntityHttpException;
@@ -37,10 +38,7 @@ class OrderController extends Controller
$lastPrice = (float) (Price::latest('created_at')->value('price') ?? 0);
$mainWallet = $customer->wallet->first(
fn ($wallet) => is_null($wallet->product_id) && is_null($wallet->fund_id)
) ?? $customer->wallet->first();
$goldAmount = (float) ($mainWallet->gold ?? 0);
$goldAmount = app(WalletBalanceService::class)->effectiveMainWalletGold((int) $customerId);
$orders = Order::query()
->where('customer_id', $customerId)