LikeCounter::likeable()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 0
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
3
namespace Turahe\Likeable\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Turahe\Likeable\Contracts\LikeCounter as LikeCounterContract;
7
8
/**
9
 * Class LikeCounter.
10
 */
11
class LikeCounter extends Model implements LikeCounterContract
12
{
13
    protected $table = 'like_counters';
14
    protected $fillable = [
15
        'type_id',
16
        'count',
17
    ];
18
19
    /**
20
     * The attributes that should be cast to native types.
21
     *
22
     * @var array
23
     */
24
    protected $casts = [
25
        'count' => 'integer',
26
    ];
27
28
    /**
29
     * Likeable model relation.
30
     *
31
     * @return \Illuminate\Database\Eloquent\Relations\MorphTo
32
     */
33
    public function likeable()
34
    {
35
        return $this->morphTo();
36
    }
37
}
38