/** * Create a new user instance after a valid registration. * * @param array $data * @return User */ protected function create(array $data) { $user = new User(['name' => $data['name'], 'email' => $data['email'], 'password' => bcrypt($data['password'])]); $user->role = 'user'; $user->save(); return $user; // return User::create([ // 'name' => $data['name'], // 'email' => $data['email'], // 'password' => bcrypt($data['password']), // ]); }
public function postProfileRegisterAllow(Request $request) { $userId = $request->input('userId'); $user = User::findOrFail($userId); $user->profileD->actived = 1; switch ($user->profileD->type) { case '1': $user->profileD->FchVencimiento = Carbon::now()->addMonths(1); break; case '2': $user->profileD->FchVencimiento = Carbon::now()->addMonths(3); break; case '3': $user->profileD->FchVencimiento = Carbon::now()->addMonths(6); break; default: # code... break; } $user->profileD->save(); return "El usuario " . $user->name . " ya es un usuario."; }
/** * Update the specified resource in storage. * * @param int $id * @return Response */ public function update(UserUpdateRequest $request, $id) { $user = User::findOrFail($id); $user->fill($request->all()); $user->role = $request->input('role'); $user->save(); Session::flash('message', 'Usuario Editado Correctamente'); return Redirect::to('/administration/users'); }