Added where_id and or_where_id to the query builder.
This commit is contained in:
parent
320c72edbe
commit
277be84853
|
@ -2,6 +2,7 @@
|
|||
|
||||
use System\Str;
|
||||
use System\Config;
|
||||
use System\Paginator;
|
||||
|
||||
class Query {
|
||||
|
||||
|
@ -238,6 +239,30 @@ public function or_where($column, $operator, $value)
|
|||
return $this->where($column, $operator, $value, 'OR');
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a where condition for the primary key to the query.
|
||||
* This is simply a short-cut method for convenience.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return Query
|
||||
*/
|
||||
public function where_id($value)
|
||||
{
|
||||
return $this->where('id', '=', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add an or where condition for the primary key to the query.
|
||||
* This is simply a short-cut method for convenience.
|
||||
*
|
||||
* @param mixed $value
|
||||
* @return Query
|
||||
*/
|
||||
public function or_where_id($value)
|
||||
{
|
||||
return $this->or_where('id', '=', $value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a where in condition to the query.
|
||||
*
|
||||
|
@ -473,7 +498,7 @@ public function paginate($per_page, $columns = array('*'))
|
|||
|
||||
$this->select($columns);
|
||||
|
||||
return \System\Paginator::make($this->for_page(\System\Paginator::page($total, $per_page), $per_page)->get(), $total, $per_page);
|
||||
return Paginator::make($this->for_page(Paginator::page($total, $per_page), $per_page)->get(), $total, $per_page);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue