getKeyName() public method

Get the primary key for the model.
public getKeyName ( ) : string
return string
Example #1
0
 /**
  * Find a model by its primary key.
  *
  * @param  mixed  $id
  * @param  array  $columns
  * @return \LMongo\Eloquent\Model|null
  */
 public function find($id, $columns = array())
 {
     if (!$id instanceof MongoID) {
         $id = new MongoID($id);
     }
     $this->query->where($this->model->getKeyName(), $id);
     return $this->first($columns);
 }