1
0
mirror of https://github.com/flarum/core.git synced 2025-07-19 07:41:22 +02:00

Allows callables for default model attribute to gain access

to the current model in order to calculate the value needed.
This commit is contained in:
Daniël Klabbers
2020-10-07 11:26:58 +02:00
parent 3a736d660b
commit f17c6da53e

View File

@@ -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);