Passed
Push — master ( 0378d7...bd60cc )
by
04:19
created

FaqArticle::category()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
<?php
2
3
/*
4
 * This file is part of the Qsnh/meedu.
5
 *
6
 * (c) XiaoTeng <[email protected]>
7
 *
8
 * This source file is subject to the MIT license that is bundled
9
 * with this source code in the file LICENSE.
10
 */
11
12
namespace App\Models;
13
14
use Illuminate\Database\Eloquent\Model;
15
16
class FaqArticle extends Model
17
{
18
    protected $table = 'faq_articles';
19
20
    protected $fillable = [
21
        'category_id', 'admin_id', 'title', 'content',
22
    ];
23
24
    protected $appends = [
25
        'edit_url', 'destroy_url',
26
    ];
27
28
    /**
29
     * @return \Illuminate\Database\Eloquent\Relations\BelongsTo
30
     */
31
    public function category()
32
    {
33
        return $this->belongsTo(FaqCategory::class, 'category_id');
34
    }
35
36
    /**
37
     * @return string
38
     */
39
    public function getEditUrlAttribute()
40
    {
41
        return route('backend.faq.article.edit', $this);
0 ignored issues
show
Bug introduced by
$this of type App\Models\FaqArticle is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

41
        return route('backend.faq.article.edit', /** @scrutinizer ignore-type */ $this);
Loading history...
42
    }
43
44
    /**
45
     * @return string
46
     */
47
    public function getDestroyUrlAttribute()
48
    {
49
        return route('backend.faq.article.destroy', $this);
0 ignored issues
show
Bug introduced by
$this of type App\Models\FaqArticle is incompatible with the type array expected by parameter $parameters of route(). ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

49
        return route('backend.faq.article.destroy', /** @scrutinizer ignore-type */ $this);
Loading history...
50
    }
51
}
52