Files
pterodactyl-panel/app/Models/ActivityLogSubject.php
T

60 lines
1.5 KiB
PHP
Raw Normal View History

<?php
2026-10-05 18:10:18 -04:00
declare(strict_types=1);
namespace Pterodactyl\Models;
2026-10-05 18:10:18 -04:00
use Illuminate\Database\Eloquent\Attributes\Guarded;
use Illuminate\Database\Eloquent\Attributes\Table;
use Illuminate\Database\Eloquent\Attributes\WithoutTimestamps;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
2026-10-05 18:10:18 -04:00
use Illuminate\Database\Eloquent\Relations\MorphTo;
use Illuminate\Database\Eloquent\Relations\Pivot;
/**
* \Pterodactyl\Models\ActivityLogSubject.
*
* @property int $id
* @property int $activity_log_id
* @property int $subject_id
* @property string $subject_type
2024-10-21 19:18:20 -06:00
* @property ActivityLog|null $activityLog
2026-10-05 18:10:18 -04:00
* @property Model $subject
*
2026-10-05 18:10:18 -04:00
* @method static Builder|ActivityLogSubject newModelQuery()
* @method static Builder|ActivityLogSubject newQuery()
* @method static Builder|ActivityLogSubject query()
2022-10-14 10:59:20 -06:00
*
2026-10-05 18:10:18 -04:00
* @mixin Model
*/
2026-10-05 18:10:18 -04:00
#[Guarded(['id'])]
#[Table(name: 'activity_log_subjects')]
#[WithoutTimestamps]
class ActivityLogSubject extends Pivot
{
public $incrementing = true;
/**
2026-10-05 18:10:18 -04:00
* @return BelongsTo<ActivityLog, $this>
*/
public function activityLog(): BelongsTo
{
return $this->belongsTo(ActivityLog::class);
}
/**
2026-10-05 18:10:18 -04:00
* @return MorphTo<Model, $this>
*/
public function subject(): MorphTo
{
2022-06-05 18:28:08 -04:00
$morph = $this->morphTo();
if (method_exists($morph, 'withTrashed')) { // @phpstan-ignore function.alreadyNarrowedType
2022-06-05 18:28:08 -04:00
return $morph->withTrashed();
}
return $morph;
}
}