Everyone who may change a task's status (attached subcontractors too) comments on it on the job page. Authors edit and remove their own comments; admin and management may remove anyone's (jobs.remove-any-task-comment). Edited comments show when they were edited, and task cards show the number of comments. Co-Authored-By: Claude Sonnet 5.5 <[email protected]>
39 lines
1.0 KiB
PHP
39 lines
1.0 KiB
PHP
<?php
|
|
|
|
namespace App\Modules\Jobs\Infrastructure\Persistence\Eloquent;
|
|
|
|
use Carbon\CarbonImmutable;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Attributes\Table;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
/**
|
|
* Persistence model of a task comment, used only inside the Jobs
|
|
* Infrastructure layer.
|
|
*
|
|
* @property int $id
|
|
* @property int $task_id
|
|
* @property int|null $user_id
|
|
* @property string $body
|
|
* @property CarbonImmutable|null $edited_at
|
|
* @property CarbonImmutable $created_at
|
|
*/
|
|
#[Table('task_comments')]
|
|
#[Fillable(['task_id', 'user_id', 'body', 'edited_at', 'created_at'])]
|
|
class TaskCommentModel extends Model
|
|
{
|
|
/**
|
|
* @return array<string, string>
|
|
*/
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'task_id' => 'integer',
|
|
'user_id' => 'integer',
|
|
'edited_at' => 'immutable_datetime',
|
|
'created_at' => 'immutable_datetime',
|
|
'updated_at' => 'immutable_datetime',
|
|
];
|
|
}
|
|
}
|