ObyxListener::__construct()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 4
rs 10
c 0
b 0
f 0
cc 1
eloc 1
nc 1
nop 0
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Listeners;
9
10
use Carbon\Carbon;
11
use App\Events\Obyx;
12
13
class ObyxListener
14
{
15
    /**
16
     * Create the event listener.
17
     *
18
     * @return void
0 ignored issues
show
Comprehensibility Best Practice introduced by
Adding a @return annotation to constructors is generally not recommended as a constructor does not have a meaningful return value.

Adding a @return annotation to a constructor is not recommended, since a constructor does not have a meaningful return value.

Please refer to the PHP core documentation on constructors.

Loading history...
19
     */
20
    public function __construct()
21
    {
22
        //
23
    }
24
25
    /**
26
     * Handle the event.
27
     *
28
     * @param Obyx $event
29
     *
30
     * @return void
31
     */
32
    public function handle(Obyx $event)
33
    {
34
        $obyx = \DB::table('obyx')
35
            ->where('reason', '=', $event->reason)
36
            ->first();
37
38
        \DB::table('user_obyx')->insert([
39
            'user_id'    => $event->user_id,
40
            'obyx_id'    => $obyx->id,
41
            'created_at' => Carbon::now(),
42
        ]);
43
    }
44
}
45