*/ use HasFactory; use Prunable; protected $guarded = []; protected $casts = [ 'metadata' => 'array', 'occurred_at' => 'datetime', ]; public function actor(): BelongsTo { return $this->belongsTo(User::class, 'actor_id'); } public function subject(): MorphTo { return $this->morphTo(); } public function prunable(): Builder { return static::query()->where('occurred_at', '<=', now()->subMonths(6)); } }