當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Images::saveUserGravatar方法代碼示例

本文整理匯總了PHP中Images::saveUserGravatar方法的典型用法代碼示例。如果您正苦於以下問題:PHP Images::saveUserGravatar方法的具體用法?PHP Images::saveUserGravatar怎麽用?PHP Images::saveUserGravatar使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Images的用法示例。


在下文中一共展示了Images::saveUserGravatar方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: store

 /**
  * Store a newly created user in storage.
  * @param  Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->checkPermission('users-manage');
     $validationRules = ['name' => 'required', 'email' => 'required|email|unique:users,email'];
     $authMethod = config('auth.method');
     if ($authMethod === 'standard') {
         $validationRules['password'] = 'required|min:5';
         $validationRules['password-confirm'] = 'required|same:password';
     } elseif ($authMethod === 'ldap') {
         $validationRules['external_auth_id'] = 'required';
     }
     $this->validate($request, $validationRules);
     $user = $this->user->fill($request->all());
     if ($authMethod === 'standard') {
         $user->password = bcrypt($request->get('password'));
     } elseif ($authMethod === 'ldap') {
         $user->external_auth_id = $request->get('external_auth_id');
     }
     $user->save();
     if ($request->has('roles')) {
         $roles = $request->get('roles');
         $user->roles()->sync($roles);
     }
     // Get avatar from gravatar and save
     if (!config('services.disable_services')) {
         $avatar = \Images::saveUserGravatar($user);
         $user->avatar()->associate($avatar);
         $user->save();
     }
     return redirect('/settings/users');
 }
開發者ID:nwalke,項目名稱:BookStack,代碼行數:36,代碼來源:UserController.php

示例2: registerNew

 /**
  * Creates a new user and attaches a role to them.
  * @param array $data
  * @return User
  */
 public function registerNew(array $data)
 {
     $user = $this->create($data);
     $this->attachDefaultRole($user);
     // Get avatar from gravatar and save
     if (!config('services.disable_services')) {
         $avatar = \Images::saveUserGravatar($user);
         $user->avatar()->associate($avatar);
         $user->save();
     }
     return $user;
 }
開發者ID:folkevil,項目名稱:BookStack,代碼行數:17,代碼來源:UserRepo.php

示例3: store

 /**
  * Store a newly created user in storage.
  * @param  Request $request
  * @return Response
  */
 public function store(Request $request)
 {
     $this->checkPermission('user-create');
     $this->validate($request, ['name' => 'required', 'email' => 'required|email|unique:users,email', 'password' => 'required|min:5', 'password-confirm' => 'required|same:password', 'role' => 'required|exists:roles,id']);
     $user = $this->user->fill($request->all());
     $user->password = bcrypt($request->get('password'));
     $user->save();
     $user->attachRoleId($request->get('role'));
     // Get avatar from gravatar and save
     if (!env('DISABLE_EXTERNAL_SERVICES', false)) {
         $avatar = \Images::saveUserGravatar($user);
         $user->avatar()->associate($avatar);
         $user->save();
     }
     return redirect('/users');
 }
開發者ID:crono,項目名稱:BookStack,代碼行數:21,代碼來源:UserController.php

示例4: registerNew

 /**
  * Creates a new user and attaches a role to them.
  * @param array $data
  * @return User
  */
 public function registerNew(array $data)
 {
     $user = $this->create($data);
     $this->attachDefaultRole($user);
     // Get avatar from gravatar and save
     if (!config('services.disable_services')) {
         try {
             $avatar = \Images::saveUserGravatar($user);
             $user->avatar()->associate($avatar);
             $user->save();
         } catch (Exception $e) {
             $user->save();
             \Log::error('Failed to save user gravatar image');
         }
     }
     return $user;
 }
開發者ID:ssddanbrown,項目名稱:bookstack,代碼行數:22,代碼來源:UserRepo.php


注:本文中的Images::saveUserGravatar方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。