/** * Show the view for stats * * @param MemberRequest $request * @return \Illuminate\Http\Response */ public function store(MemberRequest $request) { $family = new family(); $member = new member(); $family->Agency = $request['Agency']; $family->letterdate = Carbon::now(); $family->Address1 = $request['address1']; $family->address2 = $request['address2']; $family->city = $request['city']; $family->postalCode = $request['postalCode']; $family->PhoneNo = $request['PhoneNo']; $family->province = $request['province']; $family->StartDate = Carbon::now(); $family->save(); $FID = family::orderBy('FID', 'desc')->first()->FID; $member->Fname = $request['Fname']; $member->Lname = $request['Lname']; $member->Other = $request['Other'] == null ? false : true; $member->Clothing = $request['Clothing'] == null ? false : true; $member->Furniture = $request['Furniture'] == null ? false : true; $member->FID = $FID; $member->save(); $MID = member::orderBy('MID', 'desc')->first()->MID; return redirect('members/' . $MID); }
/** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param int $id * @return \Illuminate\Http\Response */ public function update(MemberRequest $request, $id) { $memberbio = member::where('MID', $id)->get()->toArray(); $family = family::where('FID', $memberbio[0]["FID"]); $member = member::findOrFail($id); $member->Fname = $request['Fname']; $member->Lname = $request['Lname']; $member->Other = $request['Other'] == null ? false : true; $member->Clothing = $request['Clothing'] == null ? false : true; $member->Furniture = $request['Furniture'] == null ? false : true; $member->save(); $family = family::findOrFail($member->FID); $family->update($request->only(['Agency', 'address1', 'address2', 'city', 'postalCode', 'province', 'PhoneNo'])); return redirect('members/' . $id); }