50 lines
1.2 KiB
PHP
50 lines
1.2 KiB
PHP
<?php
|
|
|
|
namespace App\Models;
|
|
|
|
use App\Enums\ApprovalStatus;
|
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
|
use Swindon\FilamentHashids\Traits\HasHashid;
|
|
|
|
class MediaTaskAssignment extends Pivot
|
|
{
|
|
use HasFactory, HasHashid;
|
|
|
|
protected $table = 'media_task_assignment';
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
protected function casts(): array
|
|
{
|
|
return [
|
|
'status' => ApprovalStatus::class,
|
|
'task_assignment_id' => 'integer',
|
|
'partner_media_id' => 'integer',
|
|
];
|
|
}
|
|
|
|
public function partnerMedia(): BelongsTo
|
|
{
|
|
return $this->belongsTo(PartnerMedia::class);
|
|
}
|
|
|
|
public function rejectionReasons(): MorphMany
|
|
{
|
|
return $this->morphMany(RejectionReason::class, 'rejectable');
|
|
}
|
|
|
|
public function reports(): HasMany
|
|
{
|
|
return $this->hasMany(Report::class);
|
|
}
|
|
|
|
public function taskAssignment(): BelongsTo
|
|
{
|
|
return $this->belongsTo(TaskAssignment::class);
|
|
}
|
|
}
|