mirror of
https://github.com/flarum/framework.git
synced 2025-01-20 05:32:49 +08: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:
parent
6977c24dd8
commit
ad9917f0d6
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue
Block a user