本文整理汇总了PHP中App\Repositories\UserRepository::save方法的典型用法代码示例。如果您正苦于以下问题:PHP UserRepository::save方法的具体用法?PHP UserRepository::save怎么用?PHP UserRepository::save使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Repositories\UserRepository
的用法示例。
在下文中一共展示了UserRepository::save方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$faker = Faker\Factory::create();
$tags = Tag::all();
$skills = Skill::all();
for ($i = 0; $i < 50; $i++) {
$user = User::register($faker->unique()->userName, $faker->unique()->email, bcrypt('password'), 'talent');
$this->userRepository->save($user);
$profileData = ['first_name' => $faker->firstName, 'last_name' => $faker->lastName, 'location' => $faker->city, 'describe' => $faker->numberBetween(1, count($skills) - 1), 'about' => $faker->sentence(), 'facebook' => $faker->userName, 'linked_in' => $faker->userName, 'twitter' => $faker->userName, 'meetup' => $faker->userName, 'published' => $faker->boolean()];
$userSkills = '';
foreach (range(1, rand(2, 4)) as $x) {
$id = rand(1, count($tags) - 1);
$userSkills .= $tags[$id]->name . ",";
}
$profileData['skills'] = $userSkills;
$this->dispatcher->dispatch(new UpdateProfile($user, $profileData));
}
}
示例2: handle
/**
* Execute the job.
*
* @param UserRepository $repository
* @return void
*/
public function handle(UserRepository $repository)
{
$person = User::addHouseholdMember($this->firstname, $this->lastname, $this->middleinitial, $this->gender, $this->mobile_no, $this->email);
$repository->save($person);
$member = HouseholdMember::addMember($this->household_id, $person->id);
$household = Household::findOrFail($this->household_id);
$household->members()->save($member);
event(new UserHasRegistered($person));
}
示例3: update
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @param UserRequest $request
*
* @return Response
*/
public function update($id, UserRequest $request)
{
$user = $this->userRepository->findByIdOrAbort($id);
$user = UserUpdater::create($user, $request)->update();
$this->userRepository->save($user);
$eventDescription = trans('back.events.updated', ['model' => 'Gebruiker', 'name' => $user->email]);
Activity::log($eventDescription);
flash()->success(strip_tags($eventDescription));
return redirect(URL::action('Back\\UserController@index', ['role' => $user->role]));
}
示例4: handle
/**
* Execute the command.
*
* @param Hasher $hasher
* @param UserRepository $users
* @return User
* @throws UserAlreadyExistsException
*/
public function handle(Hasher $hasher, UserRepository $users)
{
try {
$users->findByEmail($this->email);
throw new UserAlreadyExistsException($this->email);
} catch (ModelNotFoundException $e) {
$user = User::register($this->name, $this->email, $hasher->make($this->password), 'admin');
$users->save($user);
event(new UserWasRegistered($user));
return $user;
}
}
示例5: createUser
/**
* Extracts user data from request and sends it to the repository
*
* @param Request $request
*
* @return Response
*/
public function createUser(Request $request)
{
return UserRepository::save($request->input('name'), $request->input('username'), $request->input('password'), $request->input('role'));
}
示例6: handle
/**
* Execute the job.
*
* @param UserRepository $repository
* @return void
*/
public function handle(UserRepository $repository)
{
$user = User::registerHouseholdHead($this->firstname, $this->lastname, $this->middleinitial, $this->gender, $this->mobile_no, $this->email, $this->password);
$repository->save($user);
event(new UserHasRegistered($user));
}
示例7: handle
/**
* Execute the job.
*
* @param UserRepository $repository
* @return void
*/
public function handle(UserRepository $repository)
{
$person = User::updateHouseholdMember($this->user_id, $this->firstname, $this->lastname, $this->middleinitial, $this->gender, $this->mobile_no, $this->email);
$repository->save($person);
}
示例8: handle
/**
* Execute the job.
*
* @param UserRepository $repository
* @return void
*/
public function handle(UserRepository $repository)
{
$user = $this->user->activateAccount();
$repository->save($user);
}