there is a controller to save orders and there is some checkbox inputs .
i try to explain that if that input is checked ... some code must be run. but in any conditional mode
$debatorprice
, $payment
and $kalaf
are returned null
public function store(Request $request)
{
if ($request['image']){
$file = $request['image'];
$imgname = $file->getClientOriginalName();
$this->ImageUploader($file, '/upload/orders/');
}else{
$imgname=null;
}
$payment="";
$debatorprice="";
if ($request->has('paymentstatus')){
$payment=1;
$debatorprice=0;
}else{
$payment=0;
$totalprice=$request->totalprice;
$beforeprice=$request->beforeprice;
$debatorprice=$totalprice-$beforeprice;
}
$kalaf='';
if ($request->has('kalaf')){
$kalaf=1;
}else{
$kalaf=0;
}
offlineorder::create([
'ProductType'=>$request->producttype,
'OtherProduct'=>$request->otherproduct,
'CustomerName'=>$request->customername,
'CorporateName'=>$request->corporatename,
'Phone'=>$request->phone,
'Width'=>$request->width,
'Height'=>$request->height,
'Model'=>$request->model,
'Material'=>$request->material,
'Color'=>$request->color,
'Count'=>$request->count,
'Kalaf'=>$request->kalaf,
'Image'=>$imgname,
'Text'=>$request->text,
'Description'=>$request->description,
'TotalPrice'=>$request->totalprice,
'BeforePrice'=>$request->beforeprice,
'PaymentStatus'=>$payment,
'DebtorPrice'=>$debatorprice,
'SKU'=>$request->sku,
'ChapStatus'=>0,
'DesignStatus'=>0,
'View'=>0,
'Link'=>0,
]);
session()->flash('add_order','سفارش شما با موفقیت ثبت شد');
return back();
}
i try if ($request->paymentstatus==null)
but it didn't work too
Aucun commentaire:
Enregistrer un commentaire