Answers for "Laravel eloquent mass pruning model"

0

Laravel eloquent mass pruning model

<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\MassPrunable;

class Flight extends Model
{
    use MassPrunable;

    /**
     * Get the prunable model query.
     *
     * @return \Illuminate\Database\Eloquent\Builder
     */
    public function prunable()
    {
        return static::where('created_at', '<=', now()->subMonth());
    }
}
Posted by: Guest on July-24-2021

Code answers related to "Laravel eloquent mass pruning model"

Browse Popular Code Answers by Language