Commit a68d2242 authored by Jason Lewis's avatar Jason Lewis

Add the find method to the Eloquent Query class.

Signed-off-by: 's avatarJason Lewis <jason.lewis1991@gmail.com>
parent 8ff052cb
......@@ -50,6 +50,22 @@ class Query {
$this->table = $this->table();
}
/**
* 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.
*
......
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