67 lines
1.4 KiB
PHP
67 lines
1.4 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
|
|
{
|
|
|
|
/**
|
|
* The database table used by the model.
|
|
*
|
|
* @var string
|
|
*/
|
|
protected $table = 'helpdesk_ticket_time_logs';
|
|
|
|
/**
|
|
* The attributes that are mass assignable.
|
|
*
|
|
* @var list<string>
|
|
*/
|
|
protected $fillable = [
|
|
'ticket_id',
|
|
'user_id',
|
|
'minutes',
|
|
'description',
|
|
'logged_at',
|
|
'started_at',
|
|
'ended_at',
|
|
'duration_seconds',
|
|
];
|
|
|
|
/**
|
|
* The attributes that should be cast.
|
|
*
|
|
* @var array<string, string>
|
|
*/
|
|
protected $casts = [
|
|
'ticket_id' => 'integer',
|
|
'user_id' => 'integer',
|
|
'minutes' => 'integer',
|
|
'duration_seconds' => 'integer',
|
|
'logged_at' => 'datetime',
|
|
'started_at' => 'datetime',
|
|
'ended_at' => 'datetime',
|
|
];
|
|
|
|
/**
|
|
* Get the ticket this time log belongs to.
|
|
*/
|
|
public function ticket(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Ticket::class, 'ticket_id');
|
|
}
|
|
|
|
/**
|
|
* Get the user this time log belongs to.
|
|
*/
|
|
public function user(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'user_id');
|
|
}
|
|
}
|