/
BlogItemComment.php
60 lines (51 loc) · 1.15 KB
/
BlogItemComment.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
<?php
namespace Numencode\Models\Blog;
use Numencode\Models\User\User;
use Laraplus\Data\Translatable;
use Illuminate\Database\Eloquent\Model;
class BlogItemComment extends Model
{
use Translatable;
/**
* The database table used by the model.
*
* @var string
*/
protected $table = 'blog_item_comment';
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = ['user_id', 'is_published', 'comment'];
/**
* No fallback translation.
*
* @var bool
*/
protected $withFallback = false;
/**
* Use only translated items.
*
* @var bool
*/
protected $onlyTranslated = true;
/**
* Comment belongs to a blog entry.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function entry()
{
return $this->belongsTo(BlogItem::class, 'blog_item_id');
}
/**
* Comment belongs to a user.
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function user()
{
return $this->belongsTo(User::class, 'user_id');
}
}