本文整理汇总了PHP中App\Model\User::select方法的典型用法代码示例。如果您正苦于以下问题:PHP User::select方法的具体用法?PHP User::select怎么用?PHP User::select使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类App\Model\User
的用法示例。
在下文中一共展示了User::select方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAllUser
/**
* Get all user
* @return mixed
*/
public function getAllUser()
{
$users = User::select('id', 'name', 'email')->get();
$users = $users->reject(function ($user) {
return $user->hasRole('admin') === true;
});
return $users;
}
示例2: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index(DatabaseManager $db, Request $request)
{
$users = User::select('u_id', 'u_name', 'e-mail', 'location', 'skype', 'int_phone', 'desks.id as desk', 'departmants.job', 'departmants.dep', 'departmants.users as dep_users', 'rights.users as rights')->leftJoin('desks', 'users_id', '=', 'u_id')->leftJoin('rights', 'user_id', '=', 'u_id')->join('departmants', 'departmants.id', '=', 'departmant_id')->where('departmant_id', '!=', 21)->get()->keyBy('u_id')->toArray();
$host = getenv('COMPUTERNAME');
if (!in_array($host, ['SOFWKS0188', 'SOFWKS0159', 'SOFWKS0140'])) {
$host = explode('.', gethostbyaddr($request->server->get('REMOTE_ADDR')));
$host = $host[0];
}
$res = $db->table('computers')->select('user_id')->where('name', '=', $host)->first();
if ($res) {
$users[$res->user_id]['current'] = true;
$users[$res->user_id]['edit'] = $this->checkUser($users[$res->user_id]);
}
// Apply data restrictions
if (empty($res) || !$users[$res->user_id]['edit']) {
$users = $this->filterRestrictedData($users);
}
$users = array_merge($users, $this->getSpecialUsers());
return response()->json($users);
}
示例3: getPowerById
public function getPowerById($id)
{
return User::select('power')->where('id', $id)->take(1)->get()[0]['power'];
}
示例4: BB
public function BB()
{
return \Bin\View\View::make('index.php')->with('a', User::select('select * from test', 'data'));
}
示例5: checkUniqueEmail
/**
* Check that a users email is unique.
*
* @param int $user_id The users id.
* @param string $email The email address.
*
* @return int `0` for not in use, `1` for in use
*/
public function checkUniqueEmail($user_id, $email)
{
return $this->User->select('id')->where('email=? AND id<>?', array($email, $user_id))->limit(1)->data()->rowCount();
}