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


PHP Sentinel::findUserById方法代码示例

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


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

示例1: updateUserInfo

 /**
  * Updates user information
  * @param  array  $data
  * @return
  */
 public function updateUserInfo(array $data, $id)
 {
     try {
         $user = \Sentinel::findUserById($id);
         $user->email = $data['email'];
         $user->last_name = $data['last_name'];
         $user->first_name = $data['first_name'];
         if ($data['password']) {
             $user->password = $data['password'];
         }
         // if($data['image'])
         // {
         //     $file      = $data['image'];
         //     $filename  = str_random(30);
         //     $filename .= "." . $file->getClientOriginalExtension();
         //     $file->move('public/img', $filename);
         //     $user->image = $filename;
         // }
         $user->save();
         return $user;
     } catch (\Cartalyst\Sentry\Users\UserExistsException $e) {
         return 'User with that login already exists';
     } catch (\Cartalyst\Sentry\Users\UserNotFoundException $e) {
         return 'User was not found';
     }
 }
开发者ID:chesternaguit,项目名称:laravel5-project-starter,代码行数:31,代码来源:UserRepository.php

示例2: array

<?php

return array('db' => array('table' => 'users', 'order' => array('id' => 'ASC'), 'pagination' => array('per_page' => [12 => 12, 24 => 24, 50 => 50])), 'options' => array('caption' => 'Пользователи'), 'position' => array('tabs' => array('Инфо' => array(['first_name', 'last_name'], 'email', 'pattern.user_password'), 'Права' => array('pattern.user_permissions'), 'Активность' => array('pattern.user_activation'))), 'fields' => array('id' => array('caption' => '#', 'type' => 'readonly', 'class' => 'col-id', 'width' => '1%', 'is_sorting' => true, 'hide' => true), 'email' => array('caption' => 'Email', 'type' => 'text', 'filter' => 'text', 'is_sorting' => true, 'validation' => array('server' => array('rules' => 'email|required'), 'client' => array('rules' => array('required' => true, 'email' => true), 'messages' => array('required' => 'Обязательно к заполнению', 'email' => 'Невалидный email')))), 'first_name' => array('caption' => 'Имя', 'type' => 'text', 'filter' => 'text', 'validation' => array('server' => array('rules' => 'required'), 'client' => array('rules' => array('required' => true), 'messages' => array('required' => 'Обязательно к заполнению')))), 'last_name' => array('caption' => 'Фамилия', 'type' => 'text', 'filter' => 'text', 'validation' => array('server' => array('rules' => 'required'), 'client' => array('rules' => array('required' => true), 'messages' => array('required' => 'Обязательно к заполнению')))), 'pattern.user_permissions' => ['caption' => 'Права', 'hide_list' => true], 'pattern.user_activation' => ['caption' => 'Активация', 'hide_list' => true], 'pattern.user_password' => ['caption' => 'Пароль', 'hide_list' => true]), 'actions' => array('search' => array('caption' => 'Поиск'), 'insert' => array('caption' => 'Добавить'), 'update' => array('caption' => 'Редактировать'), 'delete' => array('caption' => 'Удалить')), 'callbacks' => array('handleDeleteRow' => function ($id) {
    $user = \Sentinel::findUserById($id);
    $user->delete();
    return array('id' => $id, 'status' => true);
}));
开发者ID:Jarboe,项目名称:Users-component,代码行数:7,代码来源:users.php


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