ExtendedDatabaseNotification::getUrlAttribute()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 2
Bugs 1 Features 0
Metric Value
cc 1
eloc 1
c 2
b 1
f 0
nc 1
nop 0
dl 0
loc 3
rs 10
1
<?php
2
3
namespace App\Notifications;
4
5
use App\Loan;
6
use Illuminate\Notifications\DatabaseNotification;
7
8
class ExtendedDatabaseNotification extends DatabaseNotification
9
{
10
    public function loan()
11
    {
12
        return $this->belongsTo(Loan::class)
13
            ->withTrashed();
14
    }
15
16
    /**
17
     * The accessors to append to the model's array form.
18
     *
19
     * @var array
20
     */
21
    protected $appends = ['url'];
22
23
    public function getUrlAttribute()
24
    {
25
        return action('NotificationsController@show', $this->id);
26
    }
27
28
    public function humanReadableType()
29
    {
30
        switch ($this->type) {
0 ignored issues
show
Bug introduced by
The property type does not seem to exist on App\Notifications\ExtendedDatabaseNotification. Are you sure there is no database migration missing?

Checks if undeclared accessed properties appear in database migrations and if the creating migration is correct.

Loading history...
31
            case ManualReminder::class:
32
                return 'Manuell påminnelse';
33
            case FirstReminder::class:
34
                return 'Automatisk påminnelse';
35
            default:
36
                return 'Påminnelse';
37
        }
38
    }
39
}
40