/** * Display the specified resource. * * @param int $id * @return Response */ public function show($id) { $tenants = Tenant::findOrFail($id); $tname = $tenants->name . ' ' . $tenants->lname; $houses = Occupancy::where('tenant', '=', $tname)->get(); return View::make('backend.code.tenants.show', compact('tenants', 'houses')); }
/** * 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'); }