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


PHP User::update方法代码示例

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


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

示例1: record

 public function record()
 {
     $phraseId = $this->json('phrase_id');
     $userId = $this->json('user_id');
     $username = $this->json('username');
     $milliseconds = $this->json('milliseconds', 0);
     $wpm = $this->json('wpm', 0);
     $nwpm = $this->json('nwpm', 0);
     $errors = $this->json('errors', 0);
     $color = $this->json('color', 'black');
     $isMobile = $this->json('isMobile', false);
     $isTablet = $this->json('isTablet', false);
     $isDNQ = $this->json('isDNQ', false);
     if (!$userId) {
         // Generate UserId:
         $username = User::generateUsername();
         $userId = User::createNew(['username' => $username]);
     } else {
         // Update Username
         User::update($userId, ['username' => $username]);
     }
     $statId = Stat::createNew(['phrase_id' => $phraseId, 'user_id' => $userId, 'milliseconds' => $milliseconds, 'wpm' => $wpm, 'nwpm' => $nwpm, 'errors' => $errors, 'color' => $color, 'isMobile' => $isMobile, 'isTablet' => $isTablet, 'isDNQ' => $isDNQ]);
     $stats = Stat::findById($statId);
     $transform = Stat::transform($stats, ['username' => $username]);
     return $this->success($transform);
 }
开发者ID:rpastorelle,项目名称:howfastdoyoutype,代码行数:26,代码来源:StatsController.php

示例2: update

 public function update(User $user, UserRequest $request)
 {
     $user->update($request->all());
     $user->roles()->sync($request->input('roleList'));
     Flash::success(trans('general.updated_msg'));
     return redirect(route('admin.users'));
 }
开发者ID:AlexYaroma,项目名称:mightyducks,代码行数:7,代码来源:UsersController.php

示例3: updateUser

 public function updateUser(User $user, UserRequest $request)
 {
     $input = $request->all();
     // Remove empty inputs
     $input = array_filter($input);
     if ($input['type'] == 'user') {
         $user->update($input);
     } else {
         if ($input['type'] == 'data') {
             // Remove empty inputs
             $input = array_filter($input);
             // Create new row in user data if none exists
             if (is_null($user->data)) {
                 $data = new UserData();
                 $data->user_id = $user->id;
                 $data->save();
                 $data->update($input);
             } else {
                 $user->data->update($input);
             }
         }
     }
     $request->session()->flash('success', 'The user was updated.');
     return redirect('/');
 }
开发者ID:playatech,项目名称:weightlifter,代码行数:25,代码来源:UserController.php

示例4: handle

 /**
  * Execute the job.
  * @return String
  * @internal param Role $role
  */
 public function handle()
 {
     $this->user->update($this->data->except('newsletter')->toArray());
     $this->user->setAttribute('newsletter', filter_var($this->data->get('newsletter', false), FILTER_VALIDATE_BOOLEAN));
     foreach ($this->association as $key => $value) {
         if ($value != '') {
             if ($key == 'role_id') {
                 $this->user->roles()->sync(array($value));
             } else {
                 $this->user->setAttribute($key, $value);
             }
         }
     }
     $this->user->save();
     event(new UserWasUpdated($this->user));
     return $this->user;
 }
开发者ID:SkysoulDesign,项目名称:mirage.dev,代码行数:22,代码来源:UpdateUserJob.php

示例5: update

 /**
  * Update a user.
  *
  * @param UserUpdateRequest $request
  * @param User              $user
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function update(UserUpdateRequest $request, User $user)
 {
     $data = $request->only('name', 'email');
     if ($password = $request->input('password')) {
         $data['password'] = Hash::make($password);
     }
     return response()->json($user->update($data));
 }
开发者ID:MukeshKumarS,项目名称:koel,代码行数:16,代码来源:UserController.php

示例6: updateAccountData

 /**
  * Allows a user to update all their account data at once
  *
  * @param $new_data
  *
  * @return bool|int|mixed
  */
 public function updateAccountData($new_data)
 {
     // dob
     if (array_has($new_data, 'dob')) {
         // sometimes the date gets inserted as 000, so this function call fixes that
         $data['dob'] = $this->correctDateFormat($new_data['dob']);
     }
     $this->dataResult = $this->user->update($new_data);
     return $this->dataResult;
 }
开发者ID:muhamadsyahril,项目名称:ecommerce-1,代码行数:17,代码来源:AccountsRepository.php

示例7: attach

 /**
  * Прикрепяет профиль фейсбука к профилю сайта
  *
  * @param array            $attributes
  * @param \app\models\User $userIdentity
  */
 public function attach($attributes, $userIdentity)
 {
     \Yii::info(\yii\helpers\VarDumper::dumpAsString([$attributes, $userIdentity]), 'gs\\user');
     $fields = ['fb_id' => $attributes['id'], 'fb_link' => $attributes['link']];
     if ($userIdentity->getEmail() == '') {
         $fields['email'] = $attributes['email'];
         $fields['is_confirm'] = 1;
     }
     $userIdentity->update($fields);
     if (!$userIdentity->hasAvatar()) {
         $userIdentity->setAvatarFromUrl('https://graph.facebook.com/' . $attributes['id'] . '/picture?type=large', 'jpg');
     }
 }
开发者ID:CAPITALOV,项目名称:capitalov,代码行数:19,代码来源:Facebook.php

示例8: make

 public static function make($node_id, User $user, $type_id, $time, $amount)
 {
     $user->account += (double) $amount;
     if ($user->update(false, ['account'])) {
         $income = new static(['node_id' => $node_id, 'user_name' => $user->name, 'type_id' => $type_id, 'time' => $time]);
         if ($income->save()) {
             return $income;
         } else {
             throw new Exception(json_encode($income->getErrors(), JSON_PRETTY_PRINT | JSON_UNESCAPED_UNICODE));
         }
     } else {
         throw new Exception(json_encode(func_get_args()));
     }
 }
开发者ID:kissarat,项目名称:tornados.su,代码行数:14,代码来源:Income.php

示例9: post_user_edit

 public function post_user_edit(Requests\EditUserRequest $request, User $user)
 {
     $user->update($request->except('username'));
     return \back()->with('success', 'User has been updated successfully!');
 }
开发者ID:marygale,项目名称:laravel-angular,代码行数:5,代码来源:UserController.php

示例10: set_settings

 public function set_settings()
 {
     try {
         $user = new User();
         $user->id = auth()->user()->id;
         $user->first_name = Request::input('first_name');
         $user->last_name = Request::input('last_name');
         $user->email = Request::input('email');
         $user->street = Request::input('street');
         $user->city = Request::input('city');
         $user->state = Request::input('state');
         $user->zip = Request::input('zip');
         $user->update($user);
     } catch (PDOException $e) {
         die($e->getMessage());
     }
 }
开发者ID:GobleB,项目名称:TheDebtLineup,代码行数:17,代码来源:MainController.php

示例11: update

 function update()
 {
     $input = Request::all();
     User::update($input);
     return redirect("user/profile")->with("info", "Profile Updated!");
 }
开发者ID:eimg,项目名称:laravel-example,代码行数:6,代码来源:UserController.php

示例12: User

<?php

use App\Models\User;
require __DIR__ . '/autoload.php';
$user = new User();
$user->name = 'Alexandr';
$user->email = 'v@pupkin.ru';
$articles = $user::findAll();
foreach ($articles as $value) {
    echo $value->name;
    echo $value->email . '<br>';
}
$user->update(2);
开发者ID:Alexandr1987,项目名称:PHP2,代码行数:13,代码来源:index.php

示例13: update

 /**
  * Update user
  *
  * @param User $user
  * @param array $data
  */
 public static function update(User $user, $data = array())
 {
     $user->fill($data);
     $user->update();
 }
开发者ID:lyovkin,项目名称:elcoinbank,代码行数:11,代码来源:ProfileService.php

示例14: attach

 /**
  * @param array            $attributes
  * @param \app\models\User $userIdentity
  */
 public function attach($attributes, $userIdentity)
 {
     $userIdentity->update(['vk_id' => $attributes['uid'], 'vk_link' => $attributes['screen_name']]);
     if (!$userIdentity->hasAvatar()) {
         $userIdentity->setAvatarFromUrl($attributes['photo_200']);
     }
 }
开发者ID:CAPITALOV,项目名称:capitalov,代码行数:11,代码来源:VKontakte.php

示例15: handle

 public function handle(updateUserJob $Job)
 {
     $Updateusers = User::update(['username' => $Job->username, 'password' => $Job->password, 'email' => $Job->email]);
     return $Updateusers;
 }
开发者ID:PontusPd,项目名称:Running-shoes,代码行数:5,代码来源:UpdateUserJobHandler.php


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