/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { session_start(); $loguser = $_SESSION['user_id']; $data = ['modified_by' => $loguser, 'deleted' => '1']; App\tax::find($id)->update($data); }
public function cart_edit_update($id) { session_start(); $loguser = $_SESSION['user_id']; $sql = "DELETE FROM `cart_tax` WHERE `cart_id` = '{$id}'"; DB::delete(DB::raw($sql)); $t_tax = 0; if (isset($_POST['tax'])) { foreach ($_POST['tax'] as $value) { //$sql1 = "SELECT tax_code,name FROM `tax` WHERE `id` = '$value'"; $row = App\tax::first($value); var_dump($row); $t_tax = $t_tax + $row->tax_code; $sql = "INSERT INTO `cart_tax`(`cart_id`, `tax_id`,`tax_name`,`tax_value`,`user`) VALUES ('{$id}','{$value}','{$row->name}','{$row->tax_code}','{$loguser}')"; mysqli_query($conn, $sql) or trigger_error("SQL", E_USER_ERROR); } } $sql = "UPDATE `cart` SET `qty`='{$_POST['qty']}',`tax`='{$t_tax}',`discount`='{$_POST['discount']}',`price`='{$_POST['price']}' WHERE `id` = '{$id}' "; DB::update(DB::raw($sql)); return View::make('sale.cart_edit'); }