Status   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

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

3 Methods

Rating   Name   Duplication   Size   Complexity  
A tasks() 0 4 1
A projects() 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 Status extends Model
9
{
10
    protected $table = 'statuses';
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, 'status_id', 'id');
21
    }
22
23
    public function projects() : HasMany
24
    {
25
        return $this->hasMany(Project::class, 'status_id', 'id');
26
    }
27
28
    public static function findByIdOrName($value)
29
    {
30
        return static::query()
31
        ->where('id', $value)
32
        ->orWhere('name', $value)
33
        ->first();
34
    }
35
}
36