2022-05-29 16:19:04 -04:00
|
|
|
<?php
|
|
|
|
|
|
2024-03-12 22:39:16 -04:00
|
|
|
namespace App\Models;
|
2022-05-29 16:19:04 -04:00
|
|
|
|
2024-03-19 21:12:27 -04:00
|
|
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
2022-05-29 16:19:04 -04:00
|
|
|
use Illuminate\Database\Eloquent\Relations\Pivot;
|
2024-03-17 12:52:22 -04:00
|
|
|
use Illuminate\Database\Eloquent\SoftDeletes;
|
2022-05-29 16:19:04 -04:00
|
|
|
|
|
|
|
|
/**
|
2024-03-12 22:39:16 -04:00
|
|
|
* \App\Models\ActivityLogSubject.
|
2022-05-29 16:19:04 -04:00
|
|
|
*
|
|
|
|
|
* @property int $id
|
|
|
|
|
* @property int $activity_log_id
|
|
|
|
|
* @property int $subject_id
|
|
|
|
|
* @property string $subject_type
|
2024-03-12 22:39:16 -04:00
|
|
|
* @property \App\Models\ActivityLog|null $activityLog
|
2022-05-29 16:19:04 -04:00
|
|
|
* @property \Illuminate\Database\Eloquent\Model|\Eloquent $subject
|
|
|
|
|
*
|
|
|
|
|
* @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
|
|
|
*
|
2022-05-29 16:19:04 -04:00
|
|
|
* @mixin \Eloquent
|
|
|
|
|
*/
|
|
|
|
|
class ActivityLogSubject extends Pivot
|
|
|
|
|
{
|
|
|
|
|
public $incrementing = true;
|
|
|
|
|
public $timestamps = false;
|
|
|
|
|
|
|
|
|
|
protected $table = 'activity_log_subjects';
|
|
|
|
|
|
|
|
|
|
protected $guarded = ['id'];
|
|
|
|
|
|
2024-03-19 21:12:27 -04:00
|
|
|
public function activityLog(): BelongsTo
|
2022-05-29 16:19:04 -04:00
|
|
|
{
|
|
|
|
|
return $this->belongsTo(ActivityLog::class);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function subject()
|
|
|
|
|
{
|
2022-06-05 18:28:08 -04:00
|
|
|
$morph = $this->morphTo();
|
2024-03-17 12:52:22 -04:00
|
|
|
|
|
|
|
|
if (in_array(SoftDeletes::class, class_uses_recursive($morph::class))) {
|
|
|
|
|
/** @var self|Backup|UserSSHKey $morph - cannot use traits in doc blocks */
|
2022-06-05 18:28:08 -04:00
|
|
|
return $morph->withTrashed();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return $morph;
|
2022-05-29 16:19:04 -04:00
|
|
|
}
|
|
|
|
|
}
|