37 lines
903 B
PHP
37 lines
903 B
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Database\Factories\TicketFieldDefinitionFactory;
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
#[Fillable(['field_type', 'label', 'position', 'project_id'])]
|
|
class TicketFieldDefinition extends Model
|
|
{
|
|
/**
|
|
* @var array<int, string>
|
|
*/
|
|
public const FIELD_TYPES = [
|
|
'user',
|
|
'number',
|
|
];
|
|
|
|
/** @use HasFactory<TicketFieldDefinitionFactory> */
|
|
use HasFactory;
|
|
|
|
public function project(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Project::class);
|
|
}
|
|
|
|
public function ticketFieldValues(): HasMany
|
|
{
|
|
return $this->hasMany(TicketFieldValue::class)
|
|
->orderBy('ticket_id');
|
|
}
|
|
}
|