-
Notifications
You must be signed in to change notification settings - Fork 2
/
goodMemory.php
30 lines (19 loc) · 840 Bytes
/
goodMemory.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
// For Jon Miller from spindogs, as a good memory <3
function handle()
{
$this->info('--Starting--');
$cutoff_date = Carbon::now()->subMonths(2)->format('Y-m-d');
$record_cell = DirectoryRecordCell::withTrashed()
->where('deleted_at', '<=', "$cutoff_date")->count();
$this->info("$record_cell record cells found to delete");
$record = DirectoryRecord::withTrashed()
->where('deleted_at', '<=', "$cutoff_date")->count();
$this->info("$record records found to delete");
$record_cell = DirectoryRecordCell::withTrashed()
->where('deleted_at', '<=', "$cutoff_date")->forceDelete();
$record = DirectoryRecord::withTrashed()
->where('deleted_at', '<=', "$cutoff_date")->forceDelete();
$this->info('Deleted records successfully.');
$this->info('--Finishing--');
}