<?php

namespace App\Models;

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

class ApiEvent extends Model
{
    use Prunable;

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

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

}