本文整理汇总了PHP中unknown::where方法的典型用法代码示例。如果您正苦于以下问题:PHP unknown::where方法的具体用法?PHP unknown::where怎么用?PHP unknown::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unknown
的用法示例。
在下文中一共展示了unknown::where方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: scopeCustomer
/**
* Named scope for customer users
* @param unknown $query
*/
public function scopeCustomer($query)
{
$query->leftJoin('user_to_role', 'user.id', '=', 'user_to_role.user_id');
$query->leftJoin('role', 'role.id', '=', 'user_to_role.role_id');
$query->groupBy('user.id');
return $query->where('role.value', '=', 'role_customer');
}
示例2: scopePopular
/**
*
* @param unknown $query
*/
public function scopePopular($query)
{
return $query->where('votes', '>', 100);
}
示例3: scopeCustomer
/**
* Named scope for customer category
* @param unknown $query
*/
public function scopeCustomer($query)
{
return $query->where('permission.category', '=', 'customer');
}
示例4: scopeCustom
/**
* Named scope for geting custom features only
* @param unknown $query
*/
public function scopeCustom($query)
{
return $query->where('system', '=', 0);
}
示例5: scopeAdmin
/**
* Query scope for filtering admin users
* @param unknown $query
*/
public function scopeAdmin($query)
{
$id = \DB::table('user_group')->where(['name' => 'admin'])->value('id');
return $query->where('user_group_pk_id', '=', $id);
}
示例6: scopeUser
/**
* Query scope for filtering admins
* @param unknown $query
*/
public function scopeUser($query)
{
return $query->where('name', '=', 'user');
}
示例7: setFilters
/**
* Method for the create where commands for filter function
*
* @param unknown $query
* @param unknown $db
* @return string where command for audiotrack list filtering
*/
public function setFilters($query, $db)
{
$app = JFactory::getApplication();
$user = JFactory::getUser();
// Filter by Artist / Band.
if ($artist = $app->getUserStateFromRequest('filter.artist', 'filter_artist')) {
$query->where('a.artist = "' . $db->escape($artist) . '"');
}
// Filter by Category.
if ($category_id = $app->getUserStateFromRequest('filter.category_id', 'filter_category_id')) {
$query->where('a.catid = ' . (int) $category_id);
}
// Filter by Category.
if ($access_id = $app->getUserStateFromRequest('filter.access_id', 'filter_access_id')) {
$query->where('a.access = ' . (int) $access_id);
}
// Filter by User.
if ($user_id = $app->getUserStateFromRequest('filter.user_id', 'filter_user_id')) {
$query->where('a.add_by = ' . (int) $user_id);
}
// Filter by Album.
if ($album = $app->getUserStateFromRequest('filter.album', 'filter_album')) {
$query->where('a.album = "' . $db->escape($album) . '"');
}
// Filter by Year.
if ($year = $app->getUserStateFromRequest('filter.year', 'filter_year')) {
$query->where('a.year = ' . (int) $year);
}
// Filter by User.
if (JAccess::check($user->get('id'), 'core.admin') != 1) {
$query->where('a.add_by = ' . $user->get('id'));
}
return $query;
}
示例8: scopePrimary
/**
* Query scope for filtering prirmary contact number
* @param unknown $query
*/
public function scopePrimary($query)
{
return $query->where('primary', '=', '1');
}
示例9: scopeProtected
/**
* Named scope for protected navs
* @param unknown $query
*/
public function scopeProtected($query)
{
return $query->where('navigation.protected', '=', 1);
}
示例10: scopeActive
/**
* Chỉ hiện thị các bài viết (Article) đã lựa chọn cho phép hiển thị
*
* @param unknown $query
*/
public function scopeActive($query)
{
$query->where('status', 1);
}
示例11: scopeInactive
/**
* Named scope for geting inactive roles only
* @param unknown $query
*/
public function scopeInactive($query)
{
return $query->where('active', '=', 0);
}