Added ads, adblocker, fixed scrollbar, fixed route and asset links of blog

This commit is contained in:
Gitea
2025-04-28 04:10:24 +05:30
parent 08e1110abd
commit 68ad583258
9 changed files with 86 additions and 14 deletions

View File

@@ -2,6 +2,7 @@
namespace App\Models;
use Carbon\Carbon;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
@@ -18,4 +19,17 @@ class Log extends Model
'ip',
'email',
];
public static function deleteLogsFromDB() {
$cutoff = Carbon::now('UTC')->subMonths(3)->toDateTimeString();
$count = count(self::where('created_at', '<', $cutoff)
->orderBy('created_at', 'desc')
->get());
if ($count > 0) {
self::where('created_at', '<', $cutoff)->delete();
return "$count old log(s) deleted from the database.";
}
return "No logs older than 3 months found.";
}
}