BoardThread::user()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
/*
4
 * rmarchiv.tk
5
 * (c) 2016-2017 by Marcel 'ryg' Hering
6
 */
7
8
namespace App\Models;
9
10
use GeneaLabs\LaravelModelCaching\Traits\Cachable;
11
use Illuminate\Database\Eloquent\Model;
12
13
/**
14
 * Class BoardThread.
15
 *
16
 * @property int $id
17
 * @property int $cat_id
18
 * @property int $user_id
19
 * @property string $title
20
 * @property int $closed
21
 * @property int $pinned
22
 * @property int $last_user_id
23
 * @property \Carbon\Carbon $created_at
24
 * @property \Carbon\Carbon $updated_at
25
 * @property string $last_created_at
26
 * @method static \Illuminate\Database\Query\Builder|\App\Models\BoardThread whereId($value)
27
 * @method static \Illuminate\Database\Query\Builder|\App\Models\BoardThread whereCatId($value)
28
 * @method static \Illuminate\Database\Query\Builder|\App\Models\BoardThread whereUserId($value)
29
 * @method static \Illuminate\Database\Query\Builder|\App\Models\BoardThread whereTitle($value)
30
 * @method static \Illuminate\Database\Query\Builder|\App\Models\BoardThread whereClosed($value)
31
 * @method static \Illuminate\Database\Query\Builder|\App\Models\BoardThread wherePinned($value)
32
 * @method static \Illuminate\Database\Query\Builder|\App\Models\BoardThread whereLastUserId($value)
33
 * @method static \Illuminate\Database\Query\Builder|\App\Models\BoardThread whereCreatedAt($value)
34
 * @method static \Illuminate\Database\Query\Builder|\App\Models\BoardThread whereUpdatedAt($value)
35
 * @method static \Illuminate\Database\Query\Builder|\App\Models\BoardThread whereLastCreatedAt($value)
36
 * @mixin \Eloquent
37
 * @property-read \App\Models\BoardCat $cat
38
 * @property-read \Illuminate\Database\Eloquent\Collection|\App\Models\BoardPost[] $posts
39
 * @property-read \App\Models\User $user
40
 * @property-read \App\Models\User $last_user
41
 * @property-read \Illuminate\Database\Eloquent\Collection|\Venturecraft\Revisionable\Revision[] $revisionHistory
42
 * @property-read \App\Models\BoardPoll $votes
43
 */
44
class BoardThread extends Model
45
{
46
    use \Venturecraft\Revisionable\RevisionableTrait;
47
    protected $table = 'board_threads';
48
49
    public $timestamps = true;
50
51
    protected $fillable = [
52
        'cat_id',
53
        'user_id',
54
        'title',
55
        'closed',
56
        'pinned',
57
        'last_user_id',
58
        'last_created_at',
59
    ];
60
61
    protected $guarded = [];
62
63
    public function votes()
64
    {
65
        return $this->hasOne('App\Models\BoardPoll', 'id', 'thread_id');
66
    }
67
68
    public function cat()
69
    {
70
        return $this->belongsTo('App\Models\BoardCat', 'cat_id', 'id');
71
    }
72
73
    public function posts()
74
    {
75
        return $this->hasMany('App\Models\BoardPost', 'thread_id', 'id');
76
    }
77
78
    public function user()
79
    {
80
        return $this->hasOne('App\Models\User', 'id', 'user_id');
81
    }
82
83
    public function last_user()
84
    {
85
        return $this->hasOne('App\Models\User', 'id', 'last_user_id');
86
    }
87
}
88