i have a little problem here and wish your help.
axios.get('/api/NewOrder',{params: {shippingInfo: this.Costumer,shipping_date: this.shipping_date,orderIteams:this.orderIteams,payments:this.payments,ordertotal:this.ordertotal,totalrecieved:this.totalrecieved}}).then(response => {
alert(response.data);
});
when calling api with axios i get this error "message": "Trying to get property of non-object", this is my function:
public function store(Request $request)
{
$neworder=new Order;
$neworder->operatorId=auth()->guard('admin-web')->user()->id;
$neworder->outletId= auth()->guard('admin-web')->user()->outletid;
$neworder->shippingInfo=$request->query('shippingInfo');
$neworder->shipping_date=$request->query('shipping_date');
$neworder->status="en attente";
$neworder->order_total=$request->query('ordertotal');
$totalrecieved=$request->query('$totalrecieved');
if ($totalrecieved < $neworder->order_total) {
$neworder->paymentStatus="payement partial";
}else {
$neworder->paymentStatus="payee";
}
$neworder->save();
$neworder->number = date("Y").$neworder->outletId.$neworder->operatorId.$neworder->id;
$neworder->save();
return response()->json($neworder);
}
thanks in advance
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire