/** * Display the persons of the family. * * @param int $id * @return \Illuminate\Http\Response */ public function showPersons($id) { if (Gate::denies('show', Family::class)) { abort(403); } $record = Family::find($id); $data = array('title' => 'Registered Families', 'id' => $id, 'household_code' => $record->household->household_code, 'family_code' => $record->family_code, 'barangay' => $record->household->barangay, 'zone' => $record->household->zone); return view('family.persons')->with($data); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { // $family = Family::find($id); if ($family) { User::where("family_id", "=", $id)->update(["family_id" => null]); Family::destroy($id); Session::flash('status', 'The user has been deleted!'); } return redirect('families'); }