36 lines
948 B
PHP
36 lines
948 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Modules\Helpdesk\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
|
|
|
final class Project extends Model
|
|
{
|
|
use SoftDeletes;
|
|
|
|
protected $table = 'helpdesk_projects';
|
|
|
|
/** @var list<string> */
|
|
protected $fillable = ['team_id', 'title', 'slug', 'color', 'description', 'archived_at', 'is_default'];
|
|
|
|
/** @var array<string, string> */
|
|
protected $casts = ['team_id' => 'integer', 'archived_at' => 'datetime', 'is_default' => 'boolean'];
|
|
|
|
/** @return BelongsTo<Team, Project> */
|
|
public function team(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Team::class, 'team_id');
|
|
}
|
|
|
|
/** @return HasMany<Ticket> */
|
|
public function tickets(): HasMany
|
|
{
|
|
return $this->hasMany(Ticket::class, 'project_id');
|
|
}
|
|
}
|