public function update($id, MemberRequest $request) { $member = Member::find($id); $input = Input::all(); $member->name = $input['name']; $member->email = $input['email']; $member->phone = $input['phone']; if ($request->file()) { $image = $request->file('image'); $filename = $request->file('image')->getClientOriginalName(); $path = public_path('img/' . $filename); $size = '200,200'; Image::make($image->getRealPath())->resize(intval($size), null, function ($contstraint) { $contstraint->aspectRatio(); })->save($path); $member->image = 'img/' . $filename; } $member->save(); return redirect('member'); }
/** * 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); }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update($id, MemberRequest $request) { $member = Member::find($id); $oldOrder = $member->order; $newOrder = $request->input('order'); $type = $request->input('type'); /* Laravel can not handle using the request manager the validation of the size image that exceeds the configuration of php.in */ if ($this->imageHelper->fileImageSizeExceeded($request->file('image'))) { //Set the message and the error class Session::flash('message', 'The file image can not be greater than 2MB!'); Session::flash('alert-class', 'alert-danger'); return redirect()->back(); } //Fill this member with the new form information $member->fill($request->all()); //Getting the max permitted position $maxPosition = Member::where('type', $type)->count(); //If the admin informed a greater position, set the position as the maximum one if ($member->order > $maxPosition) { $member->order = $maxPosition; $newOrder = $maxPosition; } //Setting the right order $this->imageHelper->adjustUpdateOrder($type, $oldOrder, $newOrder, $member); //Checking if there was uploaded a image if ($request->file('image') != null) { //Delete the old member image from the filesystem File::delete($member->path); //Moves and sets the new uploaded image $this->imageHelper->uploadImage($request, $member); } $member->save(); //Sending the user to the accounts page return redirect()->route('member/index'); }
/** * Save a new member * * @param MemberRequest $request */ private function createMember(MemberRequest $request) { // Find order of the new member based on district (to add the member at the end of their district) $district = District::findOrFail($request->input('district')); $order = $district->members->count() + 1; // Make a new member and save it $member = new Member(); $member->first_name = $request->input('first_name'); $member->last_name = $request->input('last_name'); $member->district_id = $request->input('district'); $member->order = $order; $member->save(); // Get selected members and save them (if there are any) $groups = $request->input('group_list'); if (count($groups) > 0) { $this->syncGroups($member, $groups); } }
public function postCreateMember(MemberRequest $request, User $user) { // Pak laatst aangemaakte member $laatste_member = $user->latest()->where('role_id', '2')->first(); if ($laatste_member != null) { $laatste = $laatste_member->klantnummer; } else { $laatste = '420'; } // Maak random wachtwoord $wachtwoord = str_random(8); $newuser = new $user(['voornaam' => $request->get('voornaam'), 'achternaam' => $request->get('achternaam'), 'email' => $request->get('email'), 'password' => bcrypt($wachtwoord), 'tab_app' => $request->get('tab_app'), 'tab_app_link' => $request->get('tab_app_link'), 'benodigd_id' => null, 'role_id' => '2', 'plan_id' => $request->get('plan_id'), 'klantnummer' => $laatste + 1]); $data = array('voornaam' => $request->get('voornaam'), 'achternaam' => $request->get('achternaam'), 'email' => $request->get('email'), 'wachtwoord' => $wachtwoord); // Stuur email naar emailadres met inloggegevens Mail::send('includes.email.newmember', array('voornaam' => $request->get('voornaam'), 'achternaam' => $request->get('achternaam'), 'email' => $request->get('email'), 'wachtwoord' => $wachtwoord), function ($message) use($data) { // $message->from('*****@*****.**', 'Digitus Marketing'); $message->to($data['email'], $data['voornaam'] . ' ' . $data['achternaam'])->subject('Jouw inloggegevens'); }); $newuser->save(); $newuser->cursussen()->attach($request->input('cursus')); return redirect('jandje/users'); }
/** * Update the specified resource in storage. * * @param MemberRequest $request * @param $memberId * @return \Illuminate\Http\JsonResponse */ public function update(MemberRequest $request, $memberId) { (new Update())->run($request->all(), $memberId, 'member', true); return $this->response->noContent(); }