本文整理汇总了PHP中app\models\User::getUser方法的典型用法代码示例。如果您正苦于以下问题:PHP User::getUser方法的具体用法?PHP User::getUser怎么用?PHP User::getUser使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\User
的用法示例。
在下文中一共展示了User::getUser方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: show
/**
* Display the specified resource.
*
* @param int $id
* @param User $modelUser
* @return \Illuminate\Http\Response
*/
public function show(User $modelUser, $id)
{
$user = $modelUser->getUser($id);
if (!$user->count()) {
// return redirect('404');
abort('404');
}
$friendshipExist = $modelUser->friendshipExists(Auth::id(), $id);
$hobbies = $modelUser->getHobbies($id);
$friends = $modelUser->getApprovedFriends($id);
return view('profile', ['user' => $user, 'hobbies' => $hobbies, 'friends' => $friends, 'friendshipExist' => $friendshipExist]);
}
示例2: index
public function index()
{
$user = new User();
$config = new Config();
$current_user = $user->getUser();
$todo = new todo\Todo();
$task = $user->getTask();
$data = array();
$data['title'] = 'Sample TODO App';
// $data['firstname'] = $current_user->getName();
// $data['task'] = $task->getTaskName();
$data['message'] = 'Here is a message created in our Home controller';
$data['root'] = $config->getWebRoot();
$data['home_url'] = $config->getHomeURL();
// Lets load our views
$this->view->getView('header', $data, TRUE);
$this->view->getView('home', $data);
$this->view->getView('footer', $data, TRUE);
}
示例3: actionLogin
/**
* action for login in system
* @return string
*/
public function actionLogin()
{
$response = null;
if (\Yii::$app->request->isAjax) {
$request = \Yii::$app->request;
$user = new \app\models\User();
$user->setPassword($request->post('password'));
if ($user->checkUser($request->post('username'), $request->post('password'))) {
return '1';
}
return '0';
} else {
$request = \Yii::$app->request;
$user = new \app\models\User();
$user->username = $request->post('username');
$user->setPassword($request->post('password'));
if ($user->checkUser($request->post('username'), $request->post('password'))) {
$l = \Yii::$app->user->login($user->getUser());
$this->redirect('/' . ($l ? $user->findByUsername($request->post('username'))->username : ''));
}
}
}
示例4: getPage
function getPage($page)
{
$params = [];
if (User::isLogged()) {
$u = User::getUser();
$explodeName = explode(' ', $u->user_name);
$first = strlen($explodeName[0]) > 0 ? $explodeName[0] : '';
$last = isset($explodeName[1]) > 0 ? $explodeName[1] : '';
$params['userName'] = $u->user_name;
$params['userInfo'] = $u;
$params['firstName'] = $first;
$params['lastName'] = $last;
}
if (!User::isLogged()) {
return view('login');
}
switch ($page) {
case 'inicio':
return view('home')->with($params);
break;
case 'perfil':
return view('profile')->with($params);
/*$user = User::getUser($_SESSION['ina_user']['id']);
$user_ext = User::join("state","state.id","=","user.state_id")->join("country","country.id","=","state.country_id")->where("user.id","=",$_SESSION['ina_user']['id'])->get(array("country.phone_ext"))->first();
$params['page']['ext']=$user_ext->phone_ext;
return view('profile', array('user' => $user))->with($params);*/
break;
case 'catalogos':
$params['departments'] = Department::getAllDepartments();
return view('catalogs')->with($params);
break;
case 'pacientes':
return view('patients')->with($params);
break;
default:
break;
}
}
示例5: getActivate
/**
* Activates user
*
* @param int $id User id
* @return \Illuminate\Http\RedirectResponse
*/
public function getActivate($id)
{
$user = User::getUser($id, true);
$user->deleted_at = null;
$user->save();
User::flushCache($user);
flash()->success(trans('users.activated_success'));
return redirect()->back();
}
示例6: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id, User $userModel)
{
$user = $userModel->getUser($id);
if (count($user) < 1) {
abort(404);
}
return view('users.edit')->with('title', 'Настройки пользователя ' . $user->showname)->with('user', $user);
}
示例7: saveHistory
public function saveHistory($action, $object = null, $dop = null)
{
switch ($action) {
case 'create_category':
$message = "Создал категорию [" . $object . "]";
$label = 'Категории';
$colorLabel = 'label label-success';
break;
case 'rename_category':
$message = "Переименовал категорию [" . $object . "]";
$label = 'Категории';
$colorLabel = 'label label-success';
break;
case 'move_category':
$categoryModel = new Category();
$category = $categoryModel->getCategory($object, array('name'));
$message = "Переименовал категорию [" . $category->name . "]";
$label = 'Категории';
$colorLabel = 'label label-success';
break;
case 'status_category':
$categoryModel = new Category();
$category = $categoryModel->getCategory($object, array('name'));
if ($dop) {
$message = "Включил категорию [" . $category->name . "]";
} else {
$message = "Отключил категорию [" . $category->name . "]";
}
$label = 'Категории';
$colorLabel = 'label label-success';
break;
case 'create_user':
$message = "Создал пользователя [" . $object . "]";
$label = 'Пользователи';
$colorLabel = 'label';
break;
case 'update_user':
$message = "Отредактировал пользователя(ей) [" . $object . "]";
$label = 'Пользователи';
$colorLabel = 'label';
break;
case 'status_user':
$userModel = new User();
$user = $userModel->getUser($object, array('showname'));
if ($dop) {
$message = "Включил пользователя [" . $user->showname . "]";
} else {
$message = "Отключил пользователя [" . $user->showname . "]";
}
$label = 'Пользователи';
$colorLabel = 'label';
break;
case 'create_currency':
$message = "Создал новую валюту [" . $object . "]";
$label = 'Валюты';
$colorLabel = 'label label-warning';
break;
case 'delete_currency':
$currencyModel = new Currency();
$currency = $currencyModel->getNameCurrencyById($object);
$message = "Удалил валюту [" . $currency . "]";
$label = 'Валюты';
$colorLabel = 'label label-warning';
break;
case 'update_rate':
$currencyModel = new Currency();
$currency = $currencyModel->getNameCurrencyById($object['currency_id']);
$message = "Установил курс [" . $currency . " = " . $object['rate'] . "]";
$label = 'Валюты';
$colorLabel = 'label label-warning';
break;
case 'auto_update_currency':
$this->insert(array('label' => "Валюты", 'color_label' => 'label label-warning', 'action' => "Обновлены курсы валют по ЦБ", 'user_id' => $object, 'created_at' => date('Y-m-d H:i:s')));
return true;
break;
case 'create_note':
$message = "Создал публичную заметку";
$label = 'Заметки';
$colorLabel = 'label';
break;
case 'update_products':
$product = array();
foreach ($object as $key => $elem) {
$product[] = "<a class='h_def' href='/product/" . $key . "'>" . $key . "</a>";
}
$message = "Отредактировал товар(ы) [" . implode(', ', $product) . "]";
$label = 'Товары и цены';
$colorLabel = 'label label-primary';
break;
case 'import':
$text = '';
if (isset($object['update_prod'])) {
$text .= "[" . plural_form($object['update_prod'], 'обновлен', false) . ' ' . plural_form($object['update_prod'], 'товар') . "] ";
}
if (isset($object['add_prod'])) {
$text .= "[" . plural_form($object['add_prod'], 'добавлен', false) . ' ' . plural_form($object['add_prod'], 'товар') . "] ";
}
if (isset($object['add_to_GK'])) {
$text .= "[на ГК " . plural_form($object['add_to_GK'], 'добавлен', false) . ' ' . plural_form($object['add_to_GK'], 'товар') . "] ";
}
//.........这里部分代码省略.........