Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
CRAP
0.00% covered (danger)
0.00%
0 / 1
ResetFlyMSGAIPromptStartAndEndDate
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
6
0.00% covered (danger)
0.00%
0 / 1
 handle
0.00% covered (danger)
0.00%
0 / 6
0.00% covered (danger)
0.00%
0 / 1
6
1<?php
2
3namespace App\Console\Commands;
4
5use Illuminate\Console\Command;
6use App\Http\Models\FlyMsgAI\PromptUsage;
7
8class ResetFlyMSGAIPromptStartAndEndDate extends Command
9{
10    /**
11     * The name and signature of the console command.
12     *
13     * @var string
14     */
15    protected $signature = 'app:reset-fly-msg-ai-prompt-start-and-end-date';
16
17    /**
18     * The console command description.
19     *
20     * @var string
21     */
22    protected $description = 'Command description';
23
24    /**
25     * Execute the console command.
26     */
27    public function handle()
28    {
29        foreach (PromptUsage::all() as $promptUsage) {
30            $this->info('Resetting prompt usage start and end date for user ' . $promptUsage->user_id);
31            $promptUsage->start_date = $promptUsage->updated_at;
32            $promptUsage->end_date = $promptUsage->updated_at->addDay();
33            $promptUsage->save();
34            $this->warn('Done.');
35        }
36    }
37}