当前位置: 首页>>代码示例>>PHP>>正文


PHP UserRepository::create方法代码示例

本文整理汇总了PHP中App\Repositories\UserRepository::create方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::create方法的具体用法?PHP UserRepository::create怎么用?PHP UserRepository::create使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在App\Repositories\UserRepository的用法示例。


在下文中一共展示了UserRepository::create方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: store

 /**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUserRequest $request)
 {
     $user = $this->user->create($request->all());
     Flash::success(trans('admin/users/general.status.created'));
     // 'User successfully created');
     return redirect('/admin/users');
 }
开发者ID:slakbal,项目名称:laravel-5.1-enterprise-starter-kit,代码行数:12,代码来源:UsersController.php

示例2: store

 /**
  * Store a newly created User in storage.
  *
  * @param CreateUserRequest $request
  *
  * @return Response
  */
 public function store(CreateUserRequest $request)
 {
     $input = $request->all();
     $user = $this->userRepository->create($input);
     Flash::success('User saved successfully.');
     return redirect(route('users.index'));
 }
开发者ID:jonphipps,项目名称:api-registry,代码行数:14,代码来源:UserController.php

示例3: register

 /**
  * Register the user.
  *
  * @param RegisterRequest $request
  * @return $this|\Illuminate\Http\RedirectResponse
  */
 public function register(RegisterRequest $request)
 {
     $success = $this->repository->create($request->all());
     if (!$success) {
         return redirect()->back()->withErrors(['register_failed' => Lang::get('auth.register_failed')]);
     }
     return redirect()->route('auth.login')->with(['notice' => Lang::get('auth.register_success')]);
 }
开发者ID:Teamelite,项目名称:Dashboard,代码行数:14,代码来源:AuthController.php

示例4: postRegister

 /**
  * Create user registration.
  *
  * @param Request $request
  * @param AppMailer $mailer
  * @return \Illuminate\Http\RedirectResponse
  */
 public function postRegister(Request $request, AppMailer $mailer)
 {
     $this->validate($request, $this->validateRegistrationForm());
     $user = $this->users->create($request->all());
     if (Auth::attempt($this->getCredentials($request))) {
         $mailer->sendEmailVerificationTo($user);
     }
     return redirect('/');
 }
开发者ID:numencode,项目名称:laravel-authentication,代码行数:16,代码来源:AuthController.php

示例5: store

 /**
  * Store a newly created User in storage.
  * POST /users
  *
  * @param Request $request
  *
  * @return Response
  */
 public function store(Request $request)
 {
     if (sizeof(User::$rules) > 0) {
         $this->validateRequestOrFail($request, User::$rules);
     }
     $input = $request->all();
     $users = $this->userRepository->create($input);
     return $this->sendResponse($users->toArray(), "User saved successfully");
 }
开发者ID:jonphipps,项目名称:api-registry,代码行数:17,代码来源:UserAPIController.php

示例6: store

 /**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUserRequest $request)
 {
     $user = $this->user->create($request->all());
     if ($request->get('role')) {
         $user->roles()->sync($request->get('role'));
     } else {
         $user->roles()->sync([]);
     }
     Flash::success('User successfully created');
     return redirect('/users');
 }
开发者ID:ampodobas,项目名称:uci-law-sba-outline-bank,代码行数:16,代码来源:UsersController.php

示例7: store

 /**
  * Store a newly created User in storage.
  *
  * @param CreateUserRequest $request
  *
  * @return Response
  */
 public function store(CreateUserRequest $request)
 {
     $this->authorize('users.manage');
     $input = $request->all();
     if (!empty($input['password'])) {
         $input['password'] = bcrypt($input['password']);
     } else {
         unset($input['password']);
     }
     $user = $this->userRepository->create($input);
     $user->roles()->sync([$request->get('role')]);
     Flash::success('User saved successfully.');
     return redirect(route('users.index'));
 }
开发者ID:exfriend,项目名称:larabox,代码行数:21,代码来源:UserController.php

示例8: store

 /**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUserRequest $request)
 {
     $attributes = $request->all();
     Audit::log(Auth::user()->id, trans('admin/users/general.audit-log.category'), trans('admin/users/general.audit-log.msg-store', ['username' => $attributes['username']]));
     if (array_key_exists('selected_roles', $attributes)) {
         $attributes['role'] = explode(",", $attributes['selected_roles']);
     }
     if ($attributes['role'][0] == '') {
         $attributes['role'][0] = "2";
     }
     // Create basic user.
     $user = $this->user->create($attributes);
     // Run the update method to set enabled status and roles membership.
     $user->update($attributes);
     //       TODO: Create front end system to manage users and clusters
     //       TODO: In the meantime, give all users access to every cluster.
     $clusters = Cluster::all();
     foreach ($clusters as $cluster) {
         $user->clusters()->attach($cluster);
     }
     /*
      * Assign the new user's active cluster
      */
     $user->activateCluster($attributes['activeCluster']);
     /*
      * Assign the department
      */
     $department = Department::find($attributes['department']);
     $department->users()->save($user);
     $user->save();
     alert()->success(trans('admin/users/general.status.created'));
     // 'User successfully created');
     return redirect('/admin/users');
 }
开发者ID:sloan58,项目名称:uc-insight-esk,代码行数:39,代码来源:UsersController.php

示例9: store

 /**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUserRequest $request)
 {
     $attributes = $request->all();
     if (array_key_exists('selected_roles', $attributes)) {
         $attributes['role'] = explode(",", $attributes['selected_roles']);
     }
     // Create basic user.
     $user = $this->user->create($attributes);
     // Run the update method to set enabled status and roles membership.
     $user->update($attributes);
     Flash::success(trans('admin/users/general.status.created'));
     // 'User successfully created');
     return redirect('/admin/users');
 }
开发者ID:pieterjanmaes,项目名称:laravel-5.1-enterprise-starter-kit,代码行数:19,代码来源:UsersController.php

示例10: store

 /**
  * @param CreateUserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
  */
 public function store(CreateUserRequest $request)
 {
     $this->validate($request, array('username' => 'required|unique:users', 'email' => 'required|unique:users', 'first_name' => 'required', 'last_name' => 'required'));
     $attributes = $request->all();
     Audit::log(Auth::user()->id, trans('admin/users/general.audit-log.category'), trans('admin/users/general.audit-log.msg-store', ['username' => $attributes['username']]));
     if (array_key_exists('selected_roles', $attributes) && !empty($attributes['selected_roles'])) {
         $attributes['role'] = explode(",", $attributes['selected_roles']);
     } else {
         $attributes['role'] = [];
     }
     // Create basic user.
     $user = $this->user->create($attributes);
     // Run the update method to set enabled status and roles membership.
     $user->update($attributes);
     Flash::success(trans('admin/users/general.status.created'));
     // 'User successfully created');
     return redirect('/admin/users');
 }
开发者ID:bztrn,项目名称:laravel-5.1-enterprise-starter-kit,代码行数:23,代码来源:UsersController.php

示例11: store

 /**
  * Store a newly created resource in storage.
  *
  * @param UserRequest $request
  *
  * @return \Illuminate\Http\RedirectResponse
  */
 public function store(UserRequest $request)
 {
     $this->users->create($request->all());
     return redirect()->route('admin.users.index');
 }
开发者ID:pet1330,项目名称:tyloo,代码行数:12,代码来源:UsersController.php

示例12: create

 /**
  * Show the form for creating a new resource.
  *
  * @return Response
  */
 public function create()
 {
     return view('back.users.create', $this->user_gestion->create());
 }
开发者ID:arman-interpiar,项目名称:laravel5-example,代码行数:9,代码来源:UserController.php

示例13: createNewUser

 /**
  * Create a new user instance after a valid registration.
  *
  * @param  array $data
  * @return User
  */
 protected function createNewUser(array $data)
 {
     $user = $this->repo->create($data);
     return $user;
 }
开发者ID:valdinei,项目名称:rest,代码行数:11,代码来源:RegisterController.php

示例14: addUser

 /**
  * Add the User to the Database and Authenticate
  * @param Request $request 
  * @param User    $repo    
  */
 public function addUser(CrateUserRequest $request, User $repo)
 {
     $role = \App\Role::where('name', 'user')->get()->first();
     $user = $repo->create($request->all());
     $user->attachRole($role);
     Auth::attempt(['email' => $user->email, 'password' => $user->password]);
     return redirect()->route()->intended('registration');
 }
开发者ID:octopoda,项目名称:FLDS,代码行数:13,代码来源:RegistrationController.php


注:本文中的App\Repositories\UserRepository::create方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。