Like   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 29
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 29
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A user() 0 3 1
A likable() 0 3 1
1
<?php
2
3
namespace Hayrullah\Likes\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\MorphTo;
7
use Illuminate\Support\Facades\Config;
8
9
/**
10
 *
11
 * @license MIT
12
 * @package Hayrullah/laravel-likes
13
 *
14
 * Copyright @2020 Zaher Khirullah
15
 */
16
class Like extends Model
17
{
18
    /**
19
     * The table associated with the model.
20
     *
21
     * @var string
22
     */
23
    protected $table = 'likes';
24
25
    /**
26
     * The attributes that are mass assignable.
27
     *
28
     * @var array
29
     */
30
    protected $fillable = ['user_id'];
31
32
    /**
33
     * Define a polymorphic, inverse one-to-one or many relationship.
34
     *
35
     * @return MorphTo
36
     */
37
    public function likable()
38
    {
39
        return $this->morphTo();
40
    }
41
42
    public function user()
43
    {
44
        return $this->belongsTo(Config::get('auth.providers.users.model'));
45
    }
46
}
47