Commit a68d2242 by Jason Lewis

Add the find method to the Eloquent Query class.

Signed-off-by: Jason Lewis <jason.lewis1991@gmail.com>
parent 8ff052cb
......@@ -51,6 +51,22 @@ class Query {
}
/**
* Find a model by its primary key.
*
* @param mixed $id
* @param array $columns
* @return mixed
*/
public function find($id, $columns = array('*'))
{
$model = $this->model;
$this->table->where($model::$key, '=', $id);
return $this->first($columns);
}
/**
* Get the first model result for the query.
*
* @param array $columns
......
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