Priority   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 23
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
dl 0
loc 23
rs 10
c 0
b 0
f 0
wmc 2
lcom 0
cbo 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A tasks() 0 4 1
A findByIdOrName() 0 7 1
1
<?php
2
3
namespace Chriscreates\Projects\Models;
4
5
use Illuminate\Database\Eloquent\Model;
6
use Illuminate\Database\Eloquent\Relations\HasMany;
7
8
class Priority extends Model
9
{
10
    protected $table = 'priorities';
11
12
    public $primaryKey = 'id';
13
14
    public $guarded = ['id'];
15
16
    public $timestamps = true;
17
18
    public function tasks() : HasMany
19
    {
20
        return $this->hasMany(Task::class, 'priority_id', 'id');
21
    }
22
23
    public static function findByIdOrName($value)
24
    {
25
        return static::query()
26
        ->where('id', $value)
27
        ->orWhere('name', $value)
28
        ->first();
29
    }
30
}
31