56 lines
1.2 KiB
PHP
56 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace Modules\Helpdesk\Models;
|
|
|
|
use App\Models\User;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class TicketTimeLog extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'helpdesk_ticket_time_logs';
|
|
|
|
protected $fillable = [
|
|
'ticket_id',
|
|
'user_id',
|
|
'minutes',
|
|
'seconds',
|
|
'description',
|
|
'started_at',
|
|
'ended_at',
|
|
'logged_at',
|
|
];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'ticket_id' => 'integer',
|
|
'user_id' => 'integer',
|
|
'minutes' => 'integer',
|
|
'seconds' => 'integer',
|
|
'started_at' => 'datetime',
|
|
'ended_at' => 'datetime',
|
|
'logged_at' => 'datetime',
|
|
];
|
|
}
|
|
|
|
/**
|
|
* Get the ticket this time log belongs to.
|
|
*/
|
|
public function ticket(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Ticket::class, 'ticket_id');
|
|
}
|
|
|
|
/**
|
|
* Get the user who logged the time.
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
}
|