<?php

namespace App\Models;

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

class SecurityEvent extends Model
{
    use Prunable;

    protected $fillable = [
        'ip',
        'user_agent',
        'route',
        'description',
        'payload',
        'user_id'
    ];

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

}