Added where_id and or_where_id to the query builder.

This commit is contained in:
Taylor Otwell 2011-08-02 08:49:19 -05:00
parent 320c72edbe
commit 277be84853
1 changed files with 26 additions and 1 deletions

View File

@ -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);
}
/**