2021-06-10 21:07:20 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
class Attendance extends NexusModel
|
|
|
|
|
{
|
|
|
|
|
protected $table = 'attendance';
|
|
|
|
|
|
2021-06-13 22:21:42 +08:00
|
|
|
protected $fillable = ['uid', 'added', 'points', 'days', 'total_days'];
|
|
|
|
|
|
2021-06-10 21:07:20 +08:00
|
|
|
protected $casts = [
|
|
|
|
|
'added' => 'datetime',
|
|
|
|
|
];
|
2022-02-25 23:13:34 +08:00
|
|
|
|
|
|
|
|
const INITIAL_BONUS = 10;
|
|
|
|
|
const STEP_BONUS = 5;
|
|
|
|
|
const MAX_BONUS = 1000;
|
|
|
|
|
const CONTINUOUS_BONUS = [
|
|
|
|
|
10 => 200,
|
|
|
|
|
20 => 500,
|
|
|
|
|
30 => 1000
|
|
|
|
|
];
|
|
|
|
|
|
2022-04-04 17:26:26 +08:00
|
|
|
const MAX_RETROACTIVE_DAYS = 30;
|
|
|
|
|
|
2022-04-03 16:03:47 +08:00
|
|
|
|
|
|
|
|
public function logs(): \Illuminate\Database\Eloquent\Relations\HasMany
|
|
|
|
|
{
|
|
|
|
|
return $this->hasMany(AttendanceLog::class, 'uid', 'uid');
|
|
|
|
|
}
|
|
|
|
|
|
2021-06-10 21:07:20 +08:00
|
|
|
}
|