Skip to content

Commit 7a8c53e

Browse files
committed
feat: add __call function
Fix Twig issues when calling a variable attribute
1 parent 4f1d005 commit 7a8c53e

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

src/Model/Model.php

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,6 @@ public function getAttributeValue($key)
239239

240240
/**
241241
* Get the value of the model's primary key.
242-
*
243242
* @return mixed
244243
*/
245244
public function getPrimaryKeyValue()
@@ -248,4 +247,17 @@ public function getPrimaryKeyValue()
248247
}
249248

250249

250+
/**
251+
* Handle dynamic method calls into the model.
252+
*
253+
* @param $attribute
254+
* @param $method
255+
* @return mixed
256+
*/
257+
public function __call($attribute, $method)
258+
{
259+
return $this->attributes[$attribute];
260+
}
261+
262+
251263
}

0 commit comments

Comments
 (0)