mirror of
https://github.com/flarum/framework.git
synced 2024-12-12 14:13:37 +08:00
Cache model dates
This commit is contained in:
parent
0f140bd9d6
commit
372a159521
|
@ -38,11 +38,17 @@ abstract class Model extends Eloquent
|
|||
*/
|
||||
public function getDates()
|
||||
{
|
||||
$dates = $this->dates;
|
||||
static $dates = [];
|
||||
|
||||
event(new ModelDates($this, $dates));
|
||||
$class = get_class($this);
|
||||
|
||||
return $dates;
|
||||
if (! isset($dates[$class])) {
|
||||
event(new ModelDates($this, $this->dates));
|
||||
|
||||
$dates[$class] = $this->dates;
|
||||
}
|
||||
|
||||
return $dates[$class];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in New Issue
Block a user