Passed
Push — develop ( 62f833...95decf )
by Septianata
11:22
created

LogoutConversation   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 19
Duplicated Lines 0 %

Importance

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

1 Method

Rating   Name   Duplication   Size   Complexity  
A run() 0 10 2
1
<?php
2
3
namespace App\Conversations;
4
5
use App\Models\User;
6
use App\Support\Auth\MultipleIdentifier;
7
8
class LogoutConversation extends Conversation
9
{
10
    use MultipleIdentifier;
11
12
    /**
13
     * Start the conversation.
14
     *
15
     * @return $this
16
     */
17
    public function run()
18
    {
19
        /** @var \App\Models\User|null $user */
20
        if ($user = User::firstWhere('telegram_chat_id', $this->getUser()->getId())) {
21
            $user->update(['telegram_chat_id' => null]);
22
23
            return $this->sayRenderable('conversations.logout.alert-success');
24
        }
25
26
        return $this->sayRenderable('conversations.logout.alert-unauthenticated');
27
    }
28
}
29