Passed
Pull Request — master (#273)
by
unknown
07:48
created

ComputeStudentLeadStatus::handle()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 6
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 6
rs 10
1
<?php
2
3
namespace App\Listeners;
4
5
use Illuminate\Contracts\Queue\ShouldQueue;
6
use Illuminate\Queue\InteractsWithQueue;
7
8
class ComputeStudentLeadStatus
9
{
10
    /**
11
     * Create the event listener.
12
     *
13
     * @return void
14
     */
15
    public function __construct()
16
    {
17
        //
18
    }
19
20
    /**
21
     * Handle the event.
22
     *
23
     * @param  object  $event
24
     * @return void
25
     */
26
    public function handle($event)
27
    {
28
        //Get the student and update the lead status id
29
        $enrollment = $event->enrollment;
30
        $enrollment->student->lead_type_id = $enrollment->student->getLeadStatusAttribute();
31
        $enrollment->student->save();
32
    }
33
}
34