/** * Store a newly created resource in storage. * * @return Response */ public function store() { $user = \Users::create(\Input::only('email', 'username', 'fname', 'lname')); $user->password = \Hash::make(\Input::get('password')); // We store password separately because we don't store in human readable form if ($user->save()) { // Return to user account home } else { // Return to edit view with error } }
public function update(Request $request) { // $this->validate($request, ['name' => 'required|max:255']); $user_id = $request->input('user_id'); $new_name = $request->input('name'); $user = Users::find($user_id); $user->name = $new_name; $user_ > save(); return redirect('user/{id}'); }
public function updateProfile() { $post = Request::all(); $user = new Users(); $user->role_id = 2; // Default role is User $user->email = $post['email']; $user->password = $post['password']; $user->created_at = Carbon::now(); if ($user->save()) { return redirect('/profile'); } else { return redirect('/'); } }
/** * @Post("/profile/{id}/user", as="profiles.user") */ public function updateUser(ProfileRequest $request) { $user = \Auth::user(); //Is the old password correct? if (!Hash::check(Input::get('old_password'), $user->password)) { \Session::flash('message', 'К сожалению, пароли не совпадают, попробуйте еще раз.'); return Redirect::back()->with('incorrectPassword', true); } else { \Users::update($request, $this->user); } if (!Input::has('password')) { \Users::update($request, $this->user); } else { \Users::update(['password' => bcrypt(Input::get('password'))], $this->user); } return \Redirect::to('/profile'); }
public function getRole($id) { $role = Users::find($id); return view('roles.find')->with('roles', $roles); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { Users::destroy($id); return redirect('users'); }
/** * Remove the specified resource from storage. * * @param int $id * @return Response */ public function destroy($id) { //echo $id; exit; $user = Users::findOrFail($id)->delete(); return redirect('user'); }
public function createGroups(Request $request) { $input = $request->all(); $data = Users::createGroups($input); return response()->json($data); }