Completed
Push — master ( 14b750...48f19c )
by Vincenzo
02:26
created

Team::scopeComplete()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 7
Code Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 1
Metric Value
c 1
b 1
f 1
dl 0
loc 7
rs 9.4285
cc 1
eloc 4
nc 1
nop 1
1
<?php
2
namespace App\Lib\DsManager\Models\Orm;
3
4
5
/**
6
 * Class Team
7
 * @package App\Lib\DsManager\Models\Orm
8
 */
9
class Team extends DsManagerOrm
10
{
11
    /**
12
     * @var string
13
     */
14
    protected $table = 'teams';
15
16
    /**
17
     * @var array
18
     */
19
    protected $fillable = [
20
        'name',
21
        'nationality'
22
    ];
23
24
    /**
25
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
26
     */
27
    public function roster()
28
    {
29
        return $this->hasMany(Player::class);
30
    }
31
32
    /**
33
     * @return \Illuminate\Database\Eloquent\Relations\HasMany
34
     */
35
    public function coach()
36
    {
37
        return $this->hasOne(Coach::class);
38
    }
39
40
    /**
41
     * @param $query
42
     * @return mixed
43
     */
44
    public function scopeComplete($query)
45
    {
46
        return $query->with(
47
            'roster',
48
            'coach'
49
        );
50
    }
51
52
}