Completed
Push — master ( eebd52...3cd9a5 )
by ARCANEDEV
08:34
created

Post::category()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 4
rs 10
c 1
b 0
f 0
cc 1
eloc 2
nc 1
nop 0
1
<?php namespace Arcanesoft\Blog\Models;
2
3
use Arcanesoft\Blog\Bases\Model;
4
use Illuminate\Database\Eloquent\SoftDeletes;
5
6
/**
7
 * Class     Post
8
 *
9
 * @package  Arcanesoft\Blog\Models
10
 * @author   ARCANEDEV <[email protected]>
11
 *
12
 * @property  int             id
13
 * @property  int             user_id
14
 * @property  int             category_id
15
 * @property  string          title
16
 * @property  string          slug
17
 * @property  string          excerpt
18
 * @property  string          content
19
 * @property  string          status
20
 * @property  \Carbon\Carbon  publish_date
21
 * @property  \Carbon\Carbon  created_at
22
 * @property  \Carbon\Carbon  updated_at
23
 * @property  \Carbon\Carbon  deleted_at
24
 *
25
 * @property  \Arcanesoft\Contracts\Auth\Models\User  user
26
 * @property  \Arcanesoft\Blog\Models\Category        category
27
 */
28
class Post extends Model
29
{
30
    /* ------------------------------------------------------------------------------------------------
31
     |  Traits
32
     | ------------------------------------------------------------------------------------------------
33
     */
34
    use SoftDeletes;
35
36
    /* ------------------------------------------------------------------------------------------------
37
     |  Properties
38
     | ------------------------------------------------------------------------------------------------
39
     */
40
    /**
41
     * The database table used by the model
42
     *
43
     * @var string
44
     */
45
    protected $table = 'posts';
46
47
    /**
48
     * The attributes that are mass assignable
49
     *
50
     * @var array
51
     */
52
    protected $fillable = [];
53
54
    /**
55
     * Set or unset the timestamps for the model
56
     *
57
     * @var bool
58
     */
59
    public $timestamps = true;
60
61
    /**
62
     * The attributes that should be mutated to dates.
63
     *
64
     * @var array
65
     */
66
    protected $dates = ['publish_date', 'deleted_at'];
67
68
    /* ------------------------------------------------------------------------------------------------
69
     |  Relationships
70
     | ------------------------------------------------------------------------------------------------
71
     */
72
    /**
73
     * Category's relationship.
74
     *
75
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
76
     */
77
    public function category()
78
    {
79
        return $this->belongsTo(Category::class);
80
    }
81
}
82