added some keys in code

This commit is contained in:
2026-06-05 16:24:15 +03:30
parent 577e2f3400
commit d6286adfdf
2 changed files with 129 additions and 0 deletions
@@ -11,6 +11,7 @@ use App\Models\User;
use App\Models\Withdraw;
use App\Models\BankAccount;
use App\Models\Price;
use App\Models\Setting;
use App\Http\Controllers\Admin\TahesabController;
use App\Services\ZaarboxPriceService;
use Illuminate\Http\Request;
@@ -185,6 +186,15 @@ class WalletController extends Controller
if ($data['value'] > $wallet->cash) {
throw new UnprocessableEntityHttpException('مقدار برداشت بیشتر از موجودی است');
}
$min_withdraw = Setting::where('is_active', 1)
->where('key', 'min_withdraw')
->first();
if ($min_withdraw && (int) $min_withdraw->value > $data['value']) {
throw new UnprocessableEntityHttpException('حداقل مقدار برداشت ' . number_format((int) $min_withdraw->value) . ' ریال است');
}
$Withdraw = Withdraw::create([
'customer_id' => auth('customer')->id(),
"cash" => $data['value'],