Reputation: 637
I am adding this (float) str_replace(',', '', $orders['grandtotal']) to my store function but I am having issue:
Parse error: syntax error, unexpected '=>' (T_DOUBLE_ARROW), expecting ',' or ')'
Here's my store function look like
$orders = Orders::create($request->only(
'user_id',
'status_id',
'currency_id',
'company_id',
'purchase_no',
'notes',
'delivery_date',
'grandtotal' =>(float) str_replace(',', '', $orders['grandtotal']),
'publish'
));
Upvotes: 1
Views: 249
Reputation: 8618
Try this code
$data = $request->only(
'user_id',
'status_id',
'currency_id',
'company_id',
'purchase_no',
'notes',
'delivery_date',
'publish'
);
$data['grandtotal'] = (float) str_replace(',', '', $request->grandtotal);
$orders = Orders::create($data);
Upvotes: 1