59 lines
1.5 KiB
PHP
59 lines
1.5 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Attributes\Fillable;
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
|
|
#[Fillable(['customer_id', 'contract_id', 'feedback_channel_id', 'assigned_to', 'title', 'content', 'status', 'current_department_id', 'is_escalated'])]
|
|
class Feedback extends Model
|
|
{
|
|
public function customer(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Customer::class);
|
|
}
|
|
|
|
public function contract(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Contract::class);
|
|
}
|
|
|
|
public function feedbackChannel(): BelongsTo
|
|
{
|
|
return $this->belongsTo(FeedbackChannel::class);
|
|
}
|
|
|
|
public function assignedTo(): BelongsTo
|
|
{
|
|
return $this->belongsTo(User::class, 'assigned_to');
|
|
}
|
|
|
|
public function currentDepartment(): BelongsTo
|
|
{
|
|
return $this->belongsTo(Department::class, 'current_department_id');
|
|
}
|
|
|
|
public function transferLogs(): HasMany
|
|
{
|
|
return $this->hasMany(TicketTransferLog::class);
|
|
}
|
|
|
|
public function interactions(): HasMany
|
|
{
|
|
return $this->hasMany(FeedbackInteraction::class)->latest();
|
|
}
|
|
|
|
public function attachments(): HasMany
|
|
{
|
|
return $this->hasMany(FeedbackAttachment::class);
|
|
}
|
|
|
|
public function tags(): BelongsToMany
|
|
{
|
|
return $this->belongsToMany(FeedbackTag::class, 'feedback_feedback_tag');
|
|
}
|
|
}
|