本文整理汇总了PHP中Repository::where方法的典型用法代码示例。如果您正苦于以下问题:PHP Repository::where方法的具体用法?PHP Repository::where怎么用?PHP Repository::where使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Repository
的用法示例。
在下文中一共展示了Repository::where方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: where
/**
* @param $column
* @param $comparator
* @param $value
* @param null $function
* @param string $table
*
* @return $this
*/
public function where($column, $comparator, $value, $function = null, $table = 'self')
{
if ($column === 'publication_id') {
$table = 'publications_authors';
$this->join($table, 'author_id', '=', 'id');
}
parent::where($column, $comparator, $value, $function, $table);
return $this;
}
示例2: where
/**
* @param $column
* @param $comparator
* @param $value
* @param null $function
* @param string $table
*
* @return $this
*/
public function where($column, $comparator, $value, $function = null, $table = 'self')
{
if ($column === 'role_id') {
$table = 'roles_permissions';
$this->join .= ' LEFT JOIN `roles_permissions` ON (`roles_permissions`.`permission_id` = self.`id`)';
} else {
if ($column === 'user_id') {
$this->select = 'SELECT DISTINCT self.*';
$table = 'users_roles';
$this->join .= ' LEFT JOIN `roles_permissions` ON (`roles_permissions`.`permission_id` = self.`id`)';
$this->join .= ' LEFT JOIN `users_roles` ON (`users_roles`.`role_id` = `roles_permissions`.`role_id`)';
}
}
parent::where($column, $comparator, $value, $function, $table);
return $this;
}
示例3: where
/**
* @param $column
* @param $comparator
* @param $value
* @param null $function
* @param string $table
*
* @return $this
*/
public function where($column, $comparator, $value, $function = null, $table = 'self')
{
if ($column === 'author_id') {
$table = 'publications_authors';
$this->join($table, 'publication_id', '=', 'id');
} else {
if ($column === 'keyword_id') {
$table = 'publications_keywords';
$this->join($table, 'publication_id', '=', 'id');
} else {
if ($column === 'keyword_name') {
$this->join('publications_keywords', 'publication_id', '=', 'id');
$this->join .= ' JOIN `keywords` ON (`publications_keywords`.`keyword_id` = `keywords`.`id`)';
$table = 'keywords';
$column = 'name';
}
}
}
parent::where($column, $comparator, $value, $function, $table);
return $this;
}
示例4: whereRepository
/**
* Add the field to query to find the model
*
* @param Repository $repository
*
* @return Repository
*/
public function whereRepository($repository)
{
return $repository->where($this->getSchema()->getColumn(), $this->getValueRaw());
}