50 lines
968 B
PHP
50 lines
968 B
PHP
<?php
|
|
|
|
namespace Modules\ProjectManagement\Models;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class TaskIssue extends Model
|
|
{
|
|
protected $table = 'task_issues';
|
|
|
|
protected $fillable = [
|
|
'task_id',
|
|
'title',
|
|
'description',
|
|
'status',
|
|
'reported_by',
|
|
'resolved_by',
|
|
'resolved_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'resolved_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
public function task(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Task::class);
|
|
}
|
|
|
|
public function reporter(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'reported_by');
|
|
}
|
|
|
|
public function resolver(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'resolved_by');
|
|
}
|
|
|
|
public function isResolved(): bool
|
|
{
|
|
return $this->status === 'resolved';
|
|
}
|
|
}
|