69 lines
1.5 KiB
PHP
69 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models\Business;
|
|
|
|
use App\Abstracts\Model;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
class SystemizationTodo extends Model
|
|
{
|
|
public const STATUS_PENDING = '待办';
|
|
|
|
public const STATUS_IN_PROGRESS = '进行中';
|
|
|
|
public const STATUS_COMPLETED = '已完成';
|
|
|
|
public const STATUS_DELAYED = '已延期';
|
|
|
|
public const STATUSES = [
|
|
self::STATUS_PENDING,
|
|
self::STATUS_IN_PROGRESS,
|
|
self::STATUS_COMPLETED,
|
|
self::STATUS_DELAYED,
|
|
];
|
|
|
|
protected $table = 'business_systemization_todos';
|
|
|
|
protected $fillable = [
|
|
'company_id',
|
|
'category',
|
|
'section',
|
|
'title',
|
|
'owner',
|
|
'assignee',
|
|
'start_date',
|
|
'start_note',
|
|
'due_date',
|
|
'due_note',
|
|
'status',
|
|
'completed_at',
|
|
'progress',
|
|
'notes',
|
|
'sort_order',
|
|
'source_key',
|
|
'imported_at',
|
|
'created_by',
|
|
'updated_by',
|
|
];
|
|
|
|
protected $casts = [
|
|
'company_id' => 'integer',
|
|
'start_date' => 'date',
|
|
'due_date' => 'date',
|
|
'completed_at' => 'date',
|
|
'sort_order' => 'integer',
|
|
'imported_at' => 'datetime',
|
|
];
|
|
|
|
public function attachments(): HasMany
|
|
{
|
|
return $this->hasMany(SystemizationTodoAttachment::class, 'systemization_todo_id')
|
|
->orderBy('id');
|
|
}
|
|
|
|
public function isCompleted(): bool
|
|
{
|
|
return $this->status === self::STATUS_COMPLETED;
|
|
}
|
|
}
|