2022-05-29 16:19:04 -04:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Pterodactyl\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
2025-12-20 15:55:13 -08:00
|
|
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
|
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2022-05-29 16:19:04 -04:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* \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
|
2025-12-20 15:55:13 -08:00
|
|
|
* @property \Illuminate\Database\Eloquent\Model $subject
|
2022-05-29 16:19:04 -04:00
|
|
|
*
|
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject newModelQuery()
|
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject newQuery()
|
|
|
|
|
* @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject query()
|
2022-10-14 10:59:20 -06:00
|
|
|
*
|
2025-12-20 15:55:13 -08:00
|
|
|
* @mixin \Illuminate\Database\Eloquent\Model
|
2022-05-29 16:19:04 -04:00
|
|
|
*/
|
|
|
|
|
class ActivityLogSubject extends Pivot
|
|
|
|
|
{
|
|
|
|
|
public $incrementing = true;
|
|
|
|
|
public $timestamps = false;
|
|
|
|
|
|
|
|
|
|
protected $table = 'activity_log_subjects';
|
|
|
|
|
|
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
|
|
2025-12-20 15:55:13 -08:00
|
|
|
/**
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\ActivityLog, $this>
|
|
|
|
|
*/
|
|
|
|
|
public function activityLog(): BelongsTo
|
2022-05-29 16:19:04 -04:00
|
|
|
{
|
|
|
|
|
return $this->belongsTo(ActivityLog::class);
|
|
|
|
|
}
|
|
|
|
|
|
2025-12-20 15:55:13 -08:00
|
|
|
/**
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\MorphTo<\Illuminate\Database\Eloquent\Model, $this>
|
|
|
|
|
*/
|
|
|
|
|
public function subject(): MorphTo
|
2022-05-29 16:19:04 -04:00
|
|
|
{
|
2022-06-05 18:28:08 -04:00
|
|
|
$morph = $this->morphTo();
|
2025-12-20 15:55:13 -08:00
|
|
|
if (method_exists($morph, 'withTrashed')) { // @phpstan-ignore function.alreadyNarrowedType
|
2022-06-05 18:28:08 -04:00
|
|
|
return $morph->withTrashed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $morph;
|
2022-05-29 16:19:04 -04:00
|
|
|
}
|
|
|
|
|
}
|