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 ( 3afc5b...1a1781 )
by Mark
02:36
created

Page::setKeywordsAttribute()   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 1
dl 0
loc 4
rs 10
c 0
b 0
f 0
1
<?php
2
3
namespace App\Model;
4
5
use Carbon\Carbon;
6
use Laravel\Scout\Searchable;
7
use Illuminate\Support\Collection;
8
use App\Classes\Interfaces\Linkable;
9
use Illuminate\Database\Eloquent\Builder;
10
use Illuminate\Database\Eloquent\SoftDeletes;
11
use Illuminate\Database\Eloquent\Relations\BelongsTo;
12
use Illuminate\Database\Eloquent\Model as EloquentModel;
13
14
/**
15
 * Class Pages.
16
 *
17
 * @property Account getPublisher
18
 * @property Redirect redirect
19
 * @property Menu $menu
20
 *
21
 * @property int $id
22
 * @property string $identifier
23
 * @property string $prefix
24
 * @property string $slug
25
 * @property string $title
26
 * @property string $content
27
 * @property string $banner
28
 * @property string $heading
29
 * @property string $description
30
 * @property string $keywords
31
 * @property int $views
32
 * @property bool $sitemap
33
 * @property bool $enabled
34
 * @property string $plugin
35
 * @property bool $editable
36
 * @property bool $special
37
 * @property int $creator_id
38
 * @property int $editor_id
39
 *
40
 * @property Carbon $deleted_at
41
 * @property Carbon $created_at
42
 * @property Carbon $updated_at
43
 *
44
 * @return Page|Collection|Builder
45
 */
46
class Page extends EloquentModel implements Linkable
47
{
48
    /*
49
     * Laravel Deleting.
50
     * @ https://laravel.com/docs/5.5/eloquent#soft-deleting
51
     */
52
    use SoftDeletes;
53
    /*
54
     * Laravel Searchable Model.
55
     *
56
     * @ https://laravel.com/docs/5.3/scout#installation
57
     */
58
    use Searchable;
59
60
    /**
61
     * The table associated with the model.
62
     *
63
     * @var string
64
     */
65
    protected $table = 'pages';
66
67
    /**
68
     * The attributes that are not mass assignable.
69
     *
70
     * @var array
71
     */
72
    protected $guarded = [];
73
74
    /**
75
     * The table date columns, casted to Carbon.
76
     *
77
     * @var array
78
     */
79
    protected $dates = ['created_at', 'updated_at', 'deleted_at'];
80
81
    /**
82
     * Attributes to exclude from the Audit.
83
     *
84
     * @var array
85
     */
86
    protected $auditExclude = [
87
        'views',
88
    ];
89
90
    /**
91
     * Increment the view count of the page.
92
     *
93
     * @return int
94
     */
95
    public function incrementViews()
96
    {
97
        return $this->views = $this->views + 1;
98
    }
99
100
    /**
101
     * A page belongs to a single menu.
102
     *
103
     * @return Menu|BelongsTo
104
     */
105
    public function menu()
106
    {
107
        return $this->belongsTo(Menu::class, 'id', 'page_id');
108
    }
109
110
    /**
111
     * A page can have a redirect to another url, external or internal.
112
     *
113
     * @return Redirect|\Illuminate\Database\Eloquent\Relations\HasOne
114
     */
115
    public function redirect()
116
    {
117
        return $this->hasOne(Redirect::class, 'from', 'id');
118
    }
119
120
    /**
121
     * Get the creator model of the eloquent model.
122
     *
123
     * @return Account|\Illuminate\Database\Eloquent\Relations\BelongsTo
124
     */
125
    public function creator()
126
    {
127
        return $this->belongsTo(Account::class, 'creator_id', 'id');
128
    }
129
130
    /**
131
     * Get the creator model of the eloquent model.
132
     *
133
     * @return Account|\Illuminate\Database\Eloquent\Relations\BelongsTo
134
     */
135
    public function editor()
136
    {
137
        return $this->belongsTo(Account::class, 'editor_id', 'id');
138
    }
139
140
    /**
141
     * @return \Illuminate\Database\Eloquent\Relations\MorphOne|Collection
142
     */
143
    public function link()
144
    {
145
        return $this->morphOne(Link::class, 'from');
146
    }
147
148
    /**
149
     * @return \Illuminate\Database\Eloquent\Relations\MorphMany|Collection
150
     */
151
    public function linked()
152
    {
153
        return $this->morphMany(Link::class, 'to');
154
    }
155
156
    /**
157
     * The url that is used to view this model.
158
     *
159
     * @return string
160
     */
161
    public function route()
162
    {
163
        if ($this->prefix) {
164
            return "{$this->prefix}/{$this->slug}";
165
        }
166
167
        return "{$this->slug}";
168
    }
169
170
    /**
171
     * The name of the current model object.
172
     *
173
     * @deprecated
174
     * @return string
175
     */
176
    public function name()
177
    {
178
        return "{$this->seo_title}";
179
    }
180
181
    /**
182
     * @param $value
183
     */
184
    public function setTitleAttribute($value)
185
    {
186
        $this->attributes['seo_title'] = $value;
187
188
        $this->attributes['slug'] = str_slug($value);
189
    }
190
191
    public function getHeadingAttribute()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
192
    {
193
        return $this->attributes['seo_title'];
194
    }
195
196
    public function setHeadingAttribute($value)
197
    {
198
        $this->attributes['seo_title'] = $value;
199
    }
200
201
    public function getDescriptionAttribute()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
202
    {
203
        return $this->attributes['seo_description'];
204
    }
205
206
    public function setDescriptionAttribute($value)
207
    {
208
        $this->attributes['seo_description'] = $value;
209
    }
210
211
    public function setKeywordsAttribute($value)
212
    {
213
        $this->attributes['seo_keywords'] = $value;
214
    }
215
216
    public function getKeywordsAttribute()
0 ignored issues
show
Documentation introduced by
The return type could not be reliably inferred; please add a @return annotation.

Our type inference engine in quite powerful, but sometimes the code does not provide enough clues to go by. In these cases we request you to add a @return annotation as described here.

Loading history...
217
    {
218
        return $this->attributes['seo_keywords'];
219
    }
220
}
221