-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathWikiDailyMetrics.php
More file actions
52 lines (41 loc) · 1.08 KB
/
WikiDailyMetrics.php
File metadata and controls
52 lines (41 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<?php
namespace App;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class WikiDailyMetrics extends Model
{
use HasFactory;
protected $table = 'wiki_daily_metrics';
protected $primaryKey = 'id';
public $incrementing = false; // Disable auto-increment
protected $keyType = 'string';
protected $fillable = [
'id',
'wiki_id',
'date',
'pages',
'is_deleted',
'daily_actions',
'weekly_actions',
'monthly_actions',
'quarterly_actions',
];
// list of properties which are actual wiki metrics
public static $metricNames = [
'pages',
'is_deleted',
'daily_actions',
'weekly_actions',
'monthly_actions',
'quarterly_actions'
];
public function areMetricsEqual(WikiDailyMetrics $wikiDailyMetrics): bool
{
foreach(self::$metricNames as $field) {
if ($this->$field != $wikiDailyMetrics->$field) {
return false;
}
}
return true;
}
}