DeleteAllData::handle()   A
last analyzed

Complexity

Conditions 2
Paths 2

Size

Total Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 9
rs 9.9666
c 0
b 0
f 0
cc 2
nc 2
nop 0
1
<?php
2
3
namespace Aurawindsurfing\Messenger\Console;
4
5
use Illuminate\Console\Command;
6
use Aurawindsurfing\Messenger\Thread;
7
use Aurawindsurfing\Messenger\Message;
8
9
class DeleteAllData extends Command
10
{
11
    protected $signature = 'messenger:deleteAllData';
12
    protected $description = 'Deletes all user messages, NOT ONLY dummy data!!!';
13
14
    public function handle()
15
    {
16
        if ($this->confirm('Are you sure you want to delete all users messages? It will delete all of them!')) {
17
            Message::truncate();
18
            Thread::truncate();
19
        }
20
21
        $this->info('Deleted user messages!');
22
    }
23
}
24