From f17c6da53e18d7b54539e5dd9d73ebd29e6c9f45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Dani=C3=ABl=20Klabbers?= Date: Wed, 7 Oct 2020 11:26:58 +0200 Subject: [PATCH] Allows callables for default model attribute to gain access to the current model in order to calculate the value needed. --- framework/core/src/Database/AbstractModel.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework/core/src/Database/AbstractModel.php b/framework/core/src/Database/AbstractModel.php index 182d33b3f..7e5013a0d 100644 --- a/framework/core/src/Database/AbstractModel.php +++ b/framework/core/src/Database/AbstractModel.php @@ -82,7 +82,7 @@ abstract class AbstractModel extends Eloquent } $this->attributes = array_map(function ($item) { - return is_callable($item) ? $item() : $item; + return is_callable($item) ? $item($this) : $item; }, $this->attributes); parent::__construct($attributes);