Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
pterodactyl
GitHub Repository: pterodactyl/panel
Path: blob/1.0-develop/app/Models/ActivityLogSubject.php
10259 views
1
<?php
2
3
namespace Pterodactyl\Models;
4
5
use Illuminate\Database\Eloquent\Relations\Pivot;
6
use Illuminate\Database\Eloquent\Relations\MorphTo;
7
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8
9
/**
10
* \Pterodactyl\Models\ActivityLogSubject.
11
*
12
* @property int $id
13
* @property int $activity_log_id
14
* @property int $subject_id
15
* @property string $subject_type
16
* @property ActivityLog|null $activityLog
17
* @property \Illuminate\Database\Eloquent\Model $subject
18
*
19
* @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject newModelQuery()
20
* @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject newQuery()
21
* @method static \Illuminate\Database\Eloquent\Builder|ActivityLogSubject query()
22
*
23
* @mixin \Illuminate\Database\Eloquent\Model
24
*/
25
class ActivityLogSubject extends Pivot
26
{
27
public $incrementing = true;
28
public $timestamps = false;
29
30
protected $table = 'activity_log_subjects';
31
32
protected $guarded = ['id'];
33
34
/**
35
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo<\Pterodactyl\Models\ActivityLog, $this>
36
*/
37
public function activityLog(): BelongsTo
38
{
39
return $this->belongsTo(ActivityLog::class);
40
}
41
42
/**
43
* @return \Illuminate\Database\Eloquent\Relations\MorphTo<\Illuminate\Database\Eloquent\Model, $this>
44
*/
45
public function subject(): MorphTo
46
{
47
$morph = $this->morphTo();
48
if (method_exists($morph, 'withTrashed')) { // @phpstan-ignore function.alreadyNarrowedType
49
return $morph->withTrashed();
50
}
51
52
return $morph;
53
}
54
}
55
56