Interaction::song()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 1
c 0
b 0
f 0
dl 0
loc 3
ccs 2
cts 2
cp 1
rs 10
cc 1
nc 1
nop 0
crap 1
1
<?php
2
3
namespace App\Models;
4
5
use App\Traits\CanFilterByUser;
6
use Illuminate\Database\Eloquent\Model;
7
use Illuminate\Database\Eloquent\Relations\BelongsTo;
8
9
/**
10
 * @property bool  $liked
11
 * @property int   $play_count
12
 * @property Song  $song
13
 * @property User  $user
14
 * @property int   $id
15
 *
16
 * @method self firstOrCreate(array $where, array $params = [])
17
 */
18
class Interaction extends Model
19
{
20
    use CanFilterByUser;
21
22
    protected $casts = [
23
        'liked' => 'boolean',
24
        'play_count' => 'integer',
25
    ];
26
    protected $guarded = ['id'];
27
    protected $hidden = ['id', 'user_id', 'created_at', 'updated_at'];
28
29 3
    public function user(): BelongsTo
30
    {
31 3
        return $this->belongsTo(User::class);
32
    }
33
34 5
    public function song(): BelongsTo
35
    {
36 5
        return $this->belongsTo(Song::class);
37
    }
38
}
39