本文整理汇总了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';
}
}
示例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);
}));