46 lines
1.1 KiB
PHP
46 lines
1.1 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
|
|
class IncidentActivity extends Model
|
|
{
|
|
protected $fillable = [
|
|
'incident_id',
|
|
'type',
|
|
'title',
|
|
'content',
|
|
'author',
|
|
];
|
|
|
|
public function incident(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PaymentIncident::class, 'incident_id');
|
|
}
|
|
|
|
public function getTypeIconAttribute(): string
|
|
{
|
|
return match ($this->type) {
|
|
'email' => 'ion-md-mail',
|
|
'call' => 'ion-md-call',
|
|
'ticket' => 'ion-md-pricetag',
|
|
'status_change' => 'ion-md-swap',
|
|
'provider_response' => 'ion-md-return-left',
|
|
default => 'ion-md-create',
|
|
};
|
|
}
|
|
|
|
public function getTypeLabelAttribute(): string
|
|
{
|
|
return match ($this->type) {
|
|
'email' => 'E-Mail',
|
|
'call' => 'Telefonat',
|
|
'ticket' => 'Ticket',
|
|
'status_change' => 'Statusänderung',
|
|
'provider_response' => 'Anbieter-Antwort',
|
|
default => 'Notiz',
|
|
};
|
|
}
|
|
}
|