<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Prunable;

class EventLog extends Model
{
    use Prunable;

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = [
        'timestamp', 'source',
        'type', 'description'
    ];

    public function prunable() {
        // Mark anything older than four months as a candidate for pruning.
        return static::where('created_at', '<=', now()->subMonths(4));
    }

}
