haozi 5 лет назад
Родитель
Сommit
e37ee6a708
1 измененных файлов с 7 добавлено и 2 удалено
  1. 7 2
      app/Console/Commands/LogExpireDelete.php

+ 7 - 2
app/Console/Commands/LogExpireDelete.php

@@ -4,6 +4,7 @@ namespace App\Console\Commands;
 
 use Carbon\Carbon;
 use Illuminate\Console\Command;
+use Illuminate\Support\Facades\Date;
 use Illuminate\Support\Facades\DB;
 
 class LogExpireDelete extends Command
@@ -44,7 +45,11 @@ class LogExpireDelete extends Command
 
     public function deleteLog(){
         //前一天
-        $date=Carbon::now()->subDays(150)->format('Y-m-d');
-        DB::table('logs')->where('created_at','like',$date.'%')->delete();
+//        $date=Carbon::now()->subDays(150)->format('Y-m-d');
+//        DB::table('logs')->where('created_at','like',$date.'%')->delete();
+        DB::table('logs')->insert([
+            ['operation' => 'App', 'type' => 'test','created_at'=>new Date()],
+        ]);
+
     }
 }