generated from liutk/owl-admin-base
48 lines
1.0 KiB
PHP
48 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\{SignTime, SignType, CheckStatus};
|
|
use App\Traits\HasCheckable;
|
|
use App\Traits\HasDateTimeFormatter;
|
|
use EloquentFilter\Filterable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* 补卡申请
|
|
*/
|
|
class EmployeeSignRepair extends Model
|
|
{
|
|
use Filterable, HasCheckable, HasDateTimeFormatter;
|
|
|
|
protected $table = 'employee_sign_repairs';
|
|
|
|
protected $guarded = [];
|
|
|
|
protected $casts = [
|
|
'date' => 'datetime',
|
|
'repair_type' => SignTime::class,
|
|
'sign_type' => SignType::class,
|
|
];
|
|
|
|
public function canUpdate(): bool
|
|
{
|
|
return in_array($this->workflow?->check_status, [CheckStatus::None, CheckStatus::Fail, CheckStatus::Cancel]);
|
|
}
|
|
|
|
public function modelFilter()
|
|
{
|
|
return \App\Admin\Filters\EmployeeSignRepairFilter::class;
|
|
}
|
|
|
|
public function store()
|
|
{
|
|
return $this->belongsTo(Store::class, 'store_id');
|
|
}
|
|
|
|
public function employee()
|
|
{
|
|
return $this->belongsTo(Employee::class, 'employee_id');
|
|
}
|
|
}
|