mirror of
https://github.com/pelican-dev/panel.git
synced 2025-06-11 05:38:59 +02:00
35 lines
807 B
PHP
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;
|
|
}
|
|
}
|