Skip to content

Commit

Permalink
feat: add __call function
Browse files Browse the repository at this point in the history
Fix Twig issues when calling a variable attribute
  • Loading branch information
xchopin committed Apr 12, 2019
1 parent 4f1d005 commit 7a8c53e
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Model/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,7 +239,6 @@ public function getAttributeValue($key)

/**
* Get the value of the model's primary key.
*
* @return mixed
*/
public function getPrimaryKeyValue()
Expand All @@ -248,4 +247,17 @@ public function getPrimaryKeyValue()
}


/**
* Handle dynamic method calls into the model.
*
* @param $attribute
* @param $method
* @return mixed
*/
public function __call($attribute, $method)
{
return $this->attributes[$attribute];
}


}

0 comments on commit 7a8c53e

Please sign in to comment.