/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(StoreHouseholdRequest $request) { if (Gate::denies('create', Household::class)) { abort(403); } Household::create(['household_code' => $request->household_code, 'municipality' => $request->municipality, 'barangay' => $request->barangay, 'zone' => $request->zone]); return redirect('/household')->with('alert-success', 'The record has been saved!'); }
/** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function store(Request $request) { $household = Household::create(Input::get()); return response()->json(['id' => $household->id]); }