mirror of
https://github.com/CachetHQ/Cachet.git
synced 2025-01-17 21:49:01 +01:00
Improve the MetricPointSeeder show actual metrics!
This commit is contained in:
parent
dc85aa79c8
commit
f7b53c06f6
@ -19,11 +19,18 @@ class MetricPointSeeder extends Seeder
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
$metric = [
|
||||
'metric_id' => 1,
|
||||
'value' => rand(1, 100),
|
||||
];
|
||||
MetricPoint::truncate();
|
||||
|
||||
MetricPoint::create($metric);
|
||||
// Generate 11 hours of metric points
|
||||
for ($i=0; $i < 11; $i++) {
|
||||
$metricTime = (new DateTime())->sub(new DateInterval('PT'.$i.'H'));
|
||||
|
||||
$pointFactory = factory('CachetHQ\Cachet\Models\MetricPoint');
|
||||
$point = $pointFactory->create();
|
||||
|
||||
$point->update([
|
||||
'created_at' => $metricTime,
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user