/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { if (Gate::denies('destroy', Family::class)) { abort(403); } $record = Family::find($id); Family::destroy($id); return redirect('/family')->with('alert-info', 'The record has been deleted!'); }
/** * 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'); }