/** * Remove the specified resource from storage. * DELETE /accountreceivables/{id} * * @param int $id * @return Response */ public function destroy($id) { Occupancy::find($id)->delete(); return Redirect::route('occupancy'); }
/** * Remove the specified resource from storage. * DELETE /accountreceivables/{id} * * @param int $id * @return Response */ public function destroy($id) { $occupancy = Occupancy::find($id); $hrname = $occupancy->tenant; $hrid = $occupancy->houseID; $value = $hrname; $fname = strtok($value, " "); $tenant = Tenant::where('name', $fname)->first(); $tenant->occupancy = 'false'; $tenant->save(); $house = House::find($hrid); $house->tenant = ''; $house->status = ''; $house->save(); $occupancy->delete(); return Redirect::route('occupancy'); }