/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function delete($id) { $car = Cars::findOrFail($id); $car_in_don_dat = DonDatCT::where('xe_id', $id)->count(); dd($car_in_don_dat); die; $car->delete(); return redirect()->route('danhsachxe'); }
public function quanlydondat() { // quan ly danh sach dat xe cua nguoi dung $dondats = DonDat::where('user_id', '=', Auth::user()->nguoidung_id)->get()->toArray(); //dd($dondats); die(); foreach ($dondats as $key => $dondat) { $dondatchitiets = DonDatCT::where('don_dat_id', '=', $dondat['dondat_id'])->join('tbl_xe', 'tbl_xe.xe_id', '=', 'tbl_dondatchitiet.xe_id')->join('tbl_taixe', 'tbl_xe.tai_xe_id', '=', 'tbl_taixe.taixe_id')->join('tbl_hang', 'tbl_hang.hang_id', '=', 'tbl_xe.hang_id')->get()->toArray(); //dd($dondatchitiets); die(); array_push($dondats[$key], $dondatchitiets); } //dd($dondats); die(); return view('backend.booking.dondatmember', compact('dondats')); }