ranjith-dev #273

Merged
jothi merged 6 commits from ranjith-dev into master 2026-01-29 07:16:02 +00:00
Showing only changes of commit 7deb78f574 - Show all commits

View File

@@ -2,12 +2,15 @@
namespace App\Models;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Prunable;
use Illuminate\Database\Eloquent\Relations\BelongsTo;
use Illuminate\Database\Eloquent\SoftDeletes;
class GuardPatrolEntry extends Model
{
use Prunable;
use SoftDeletes;
protected $fillable = [
@@ -36,4 +39,15 @@ class GuardPatrolEntry extends Model
// return $this->belongsTo(CheckPointName::class);
return $this->belongsTo(CheckPointName::class, 'check_point_name_id');
}
public function prunable(): Builder
{
// // Start of two months ago (first day of that month)
// $startOfTwoMonthsAgo = now()->subMonthsNoOverflow(6)->startOfMonth();
// // End of previous month (last day of last month)
// $endOfPrevMonth = now()->subMonthNoOverflow()->endOfMonth();
// return static::whereBetween('created_at', [$startOfTwoMonthsAgo, $endOfPrevMonth]);
return static::where('created_at', '<=', now()->subMonthsNoOverflow(6));
}
}