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:
@@ -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);
|
||||
|
Reference in New Issue
Block a user