mirror of
https://github.com/flarum/framework.git
synced 2024-11-25 09:25:28 +08:00
Cache model dates
This commit is contained in:
parent
2422643de6
commit
b04e7f96c8
|
@ -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