DiscussCategoryObserver   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 12
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 5
dl 0
loc 12
rs 10
c 1
b 0
f 0
wmc 2

1 Method

Rating   Name   Duplication   Size   Complexity  
A deleting() 0 7 2
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Xetaravel\Observers;
6
7
use Xetaravel\Models\DiscussCategory;
8
9
class DiscussCategoryObserver
10
{
11
    /**
12
     * Handle the "deleting" event.
13
     */
14
    public function deleting(DiscussCategory $discussCategory): void
15
    {
16
        $discussCategory->last_conversation_id = null;
17
        $discussCategory->save();
18
19
        foreach ($discussCategory->conversations as $conversation) {
20
            $conversation->delete();
21
        }
22
    }
23
}
24