Scrutinizer GitHub App not installed

We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.

Install GitHub App

Completed
Push — master ( 7fd57f...ddf3cc )
by Mark
02:55
created

Menu::route()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 2
nc 1
nop 0
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Model;
4
5
use App\Classes\Interfaces\Linker;
6
use Carbon\Carbon;
7
use Illuminate\Database\Eloquent\Relations\MorphOne;
8
use Illuminate\Database\Eloquent\SoftDeletes;
9
use Illuminate\Database\Eloquent\Model as EloquentModel;
10
use Illuminate\Support\Collection;
11
12
/**
13
 * Class Menus.
14
 *
15
 * @property int $id
16
 * @property string $title
17
 * @property string $hyperlink
18
 * @property int $page_id
19
 * @property string $target
20
 * @property int $parent_id
21
 * @property int $order
22
 * @property bool $status
23
 * @property bool $lock
24
 * @property int $creator_id
25
 * @property int $editor_id
26
 *
27
 * @property Link $link
28
 * @property Menu $parent
29
 * @property Page $page
30
 * @property Menu $children
31
 *
32
 * @property Carbon $deleted_at
33
 * @property Carbon $created_at
34
 * @property Carbon $updated_at
35
 */
36
class Menu extends EloquentModel implements Linker
37
{
38
    /*
39
     * Laravel Deleting.
40
     * @ https://laravel.com/docs/5.5/eloquent#soft-deleting
41
     */
42
    use SoftDeletes;
43
44
    /**
45
     * Status if current menu.
46
     *
47
     * @var bool
48
     */
49
    public $active = false;
50
51
    /**
52
     * The table associated with the model.
53
     *
54
     * @var string
55
     */
56
    protected $table = 'menus';
57
58
    /**
59
     * The attributes that are not mass assignable.
60
     *
61
     * @var array
62
     */
63
    protected $guarded = [];
64
65
    /**
66
     * The relations to eager load on every query.
67
     *
68
     * @var array
69
     */
70
    protected $with = ['link.to'];
71
72
    /**
73
     * The attributes that should be mutated to dates.
74
     *
75
     * @var array
76
     */
77
    protected $dates = ['updated_at', 'created_at', 'deleted_at'];
78
79
    /**
80
     * Return the page that this menu has.
81
     *
82
     * @deprecated
83
     * @return Page|\Illuminate\Database\Eloquent\Relations\HasOne
84
     */
85
    public function page()
86
    {
87
        return $this->hasOne(Page::class, 'id', 'page_id');
88
    }
89
90
    /**
91
     * Return the menu that this belongs to.
92
     *
93
     * @return Menu|\Illuminate\Database\Eloquent\Relations\BelongsTo
94
     */
95
    public function parent()
96
    {
97
        return $this->belongsTo(self::class, 'parent_id', 'id');
98
    }
99
100
    /**
101
     * The menu can have many submenu children.
102
     *
103
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
104
     */
105
    public function children()
106
    {
107
        return $this->hasMany(self::class, 'parent_id', 'id');
108
    }
109
110
    /**
111
     * Return the link that this connects to, page or hyperlink.
112
     *
113
     * @return MorphOne|Collection|Link
114
     */
115
    public function link()
116
    {
117
        return $this->morphOne(Link::class, 'from');
118
    }
119
120
    /**
121
     * Allows the CSS to set a state on the navigation.
122
     *
123
     * @return string
124
     */
125
    public function classState()
126
    {
127
        return $this->active ? 'active' : 'inactive';
128
    }
129
130
    /**
131
     * Generate the url that this links to.
132
     *
133
     * @return mixed
0 ignored issues
show
Documentation introduced by
Consider making the return type a bit more specific; maybe use \Illuminate\Contracts\Routing\UrlGenerator|string.

This check looks for the generic type array as a return type and suggests a more specific type. This type is inferred from the actual code.

Loading history...
134
     */
135
    public function route()
136
    {
137
        return url($this->link->url());
138
    }
139
140
    /**
141
     * The name of the current model object.
142
     *
143
     * @return string
144
     */
145
    public function name()
146
    {
147
        return $this->title;
148
    }
149
}
150