public function allAuditLogs(): MorphMany
{
return $this->morphMany(AuditLog::class, 'parent')
->where(function ($query) {
$query->where(function ($query) {
$query->where('related_type', $this->getMorphClass())
->where('related_id', $this->id);
})->orWhere(function ($query) {
$query->where('parent_type', $this->getMorphClass())
->where('parent_id', $this->id);
});
});
}
public function allAuditLogs(): MorphMany
{
return $this->morphMany(AuditLog::class, 'parent')
->where(function ($query) {
$query->where(function ($query) {
$query->where('related_type', $this->getMorphClass())
->where('related_id', $this->id);
})->orWhere(function ($query) {
$query->where('parent_type', $this->getMorphClass())
->where('parent_id', $this->id);
});
});
}