pelican-panel-mirror/app/Models/ActivityLogSubject.php
2024-06-02 01:38:30 -04:00

35 lines
807 B
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\Relations\Pivot;
use Illuminate\Database\Eloquent\SoftDeletes;
class ActivityLogSubject extends Pivot
{
public $incrementing = true;
public $timestamps = false;
protected $table = 'activity_log_subjects';
protected $guarded = ['id'];
public function activityLog(): BelongsTo
{
return $this->belongsTo(ActivityLog::class);
}
public function subject()
{
$morph = $this->morphTo();
if (in_array(SoftDeletes::class, class_uses_recursive($morph::class))) {
/** @var self|Backup|UserSSHKey $morph - cannot use traits in doc blocks */
return $morph->withTrashed();
}
return $morph;
}
}