NASER optimize get price and order from goldir

This commit is contained in:
gholak tala
2026-04-04 07:47:17 +00:00
parent 81b53123b9
commit 76a344f9f2
2 changed files with 17 additions and 7 deletions
@@ -29,13 +29,16 @@ class SingleOrderController extends Controller
{
public function store(Request $request)
{
$goldir = Cnt::where('key', 'goldir_closed')->first();
if(isset($goldir) && $goldir['value'] == "true"){
$data = $request->all();
$goldir_closed = Cnt::where('key', 'goldir_closed')->first()['value'] == "true";
$goldir_buy = Cnt::where('key', 'goldir_open_buy')->first()['value'] == "false" && $data['direction'] == 1;
$goldir_sell = Cnt::where('key', 'goldir_open_sell')->first()['value'] == "false" && $data['direction'] == 2;
if($goldir_closed || $goldir_buy || $goldir_sell){
throw new UnprocessableEntityHttpException('عدم ارائه سرویس.');
}
// throw new UnprocessableEntityHttpException('به دلیل نوسانات سفارشات بسته میباشد.');
$data = $request->all();
$transactionType = $data['direction'] == 1 ? "خرید" : "فروش";
if (auth('customer')->id()) {
$data['customer_id'] = auth('customer')->id();