Subscription   A
last analyzed

Complexity

Total Complexity 4

Size/Duplication

Total Lines 34
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

Changes 0
Metric Value
dl 0
loc 34
rs 10
c 0
b 0
f 0
wmc 4
lcom 0
cbo 1

4 Methods

Rating   Name   Duplication   Size   Complexity  
A subscribable() 0 4 1
A user() 0 4 1
A threads() 0 4 1
A channels() 0 4 1
1
<?php
2
namespace Seongbae\Discuss\Models;
3
4
use Illuminate\Database\Eloquent\Model;
5
use Seongbae\Discuss\Events\NewReply;
6
use Seongbae\Discuss\Events\NewThread;
7
use Auth;
8
9
class Subscription extends Model
10
{
11
    protected $table = 'discuss_subscription';
12
13
    protected $fillable = [
14
        'subscribable_id',
15
        'subscribable_type',
16
        'user_id',
17
        'user_type'
18
    ];
19
20
	public function subscribable()
21
    {
22
        return $this->morphTo();
23
    }
24
25
    public function user()
26
    {
27
        return $this->belongsTo(config('discuss.user_type'));
28
    }
29
30
    public function threads()
31
    {
32
        return $this->morphedByMany(Thread::class, 'subscribable');
33
    }
34
35
    /**
36
     * Get all of the videos that are assigned this tag.
37
     */
38
    public function channels()
39
    {
40
        return $this->morphedByMany(Channel::class, 'subscribable');
41
    }
42
}
43