コード例 #1
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $days_old = $this->argument('days');
     $count = Notification::where('seen', 0)->where('created_at', '>=', Carbon::today()->subDays($days_old) . 'and')->count();
     $this->info("There are {$count} unseen notifications in db created the last {$days_old} days.");
 }
コード例 #2
0
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $days_old = $this->argument('days');
     Notification::where('seen', 1)->where('seen_at', '<', Carbon::today()->subDays($days_old) . 'and')->delete();
     $this->info("Deleted notifications seen at least {$days_old} days ago.");
 }