37 lines
1023 B
PHP
37 lines
1023 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Helpdesk\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
final class GitCommit extends Model
|
|
{
|
|
use HasFactory;
|
|
|
|
protected $table = 'helpdesk_git_commits';
|
|
|
|
/** @var list<string> */
|
|
protected $fillable = [
|
|
'repository_id', 'ticket_id', 'hash', 'short_hash', 'branch', 'author_name', 'author_email', 'message', 'url', 'committed_at',
|
|
];
|
|
|
|
/** @var array<string, string> */
|
|
protected $casts = ['repository_id' => 'integer', 'ticket_id' => 'integer', 'committed_at' => 'datetime'];
|
|
|
|
/** @return BelongsTo<GitRepository, GitCommit> */
|
|
public function repository(): BelongsTo
|
|
{
|
|
return $this->belongsTo(GitRepository::class, 'repository_id');
|
|
}
|
|
|
|
/** @return BelongsTo<Ticket, GitCommit> */
|
|
public function ticket(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Ticket::class, 'ticket_id');
|
|
}
|
|
}
|