We could not synchronize checks via GitHub's checks API since Scrutinizer's GitHub App is not installed for this repository.
| 1 | <?php |
||
| 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() |
||
| 180 | |||
| 181 | /** |
||
| 182 | * @param $value |
||
| 183 | */ |
||
| 184 | public function setTitleAttribute($value) |
||
| 190 | |||
| 191 | public function getHeadingAttribute() |
||
|
|
|||
| 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() |
||
| 205 | |||
| 206 | public function setDescriptionAttribute($value) |
||
| 210 | |||
| 211 | public function setKeywordsAttribute($value) |
||
| 215 | |||
| 216 | public function getKeywordsAttribute() |
||
| 220 | } |
||
| 221 |
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
@returnannotation as described here.