當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。