Commit 277be848 authored by Taylor Otwell's avatar Taylor Otwell

Added where_id and or_where_id to the query builder.

parent 320c72ed
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
use System\Str; use System\Str;
use System\Config; use System\Config;
use System\Paginator;
class Query { class Query {
...@@ -238,6 +239,30 @@ class Query { ...@@ -238,6 +239,30 @@ class Query {
return $this->where($column, $operator, $value, 'OR'); 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. * Add a where in condition to the query.
* *
...@@ -473,7 +498,7 @@ class Query { ...@@ -473,7 +498,7 @@ class Query {
$this->select($columns); $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);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment