LMongo\Eloquent\Model::getKey PHP Method

getKey() public method

Get the value of the model's primary key.
public getKey ( ) : mixed
return mixed
    public function getKey()
    {
        return (string) $this->getAttribute($this->getKeyName());
    }

Usage Example

示例#1
0
 /**
  * Associate the model instance to the given parent.
  *
  * @param  \LMongo\Eloquent\Model  $model
  * @return \LMongo\Eloquent\Model
  */
 public function associate(Model $model)
 {
     $this->parent->setAttribute($this->foreignKey, $model->getKey());
     return $this->parent->setRelation($this->relation, $model);
 }
Model