i get $value
id
= 26
i got that error, this is my controller
public function update(Request $request, $id)
{
//dd($request->all());
$validator = $this->validation($request);
// dd($validator);
if ($validator->fails()) {
return response()->json(array('errors' => $validator->getMessageBag()->toArray()));
}
$product_sales = new ProductSale($request->all());
$variable = $request->my_array;
$product_salesData = ProductSale::findOrFail($request->id);
$sale_id = $product_salesData->id;
\DB::beginTransaction();
try {
// $data->update($inputData['attributes']);
$product_salesData->update($product_sales->getAttributes());
foreach ($variable as $key => $value) {
// dd($value['sale_id']);
$ps_details = PSaleDetail::findOrFail($sale_id)->update($value);
}
\DB::commit();
return response()->json(['status' => 'success', 'title' => 'Update', 'message' => 'Product Sale '.$product_salesData->voucher_no.' is successfully updated!'], 200);
} catch (\Exception $e) {
\DB::rollback();
return (new response($e->getMessage(), 500));
}
}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire