Completed
Push — master ( 027456...ba1313 )
by Julien
05:54
created

Team::getFullName()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
eloc 2
nc 1
nop 0
1
<?php
2
3
namespace Xoco70\LaravelTournaments\Models;
4
5
class Team extends Fighter
6
{
7
    protected $table = 'team';
8
    public $timestamps = true;
9
    protected $fillable = ['short_id', 'name', 'championship_id'];
10
11
    public function competitors()
12
    {
13
        return $this->belongsToMany(Competitor::class)->withTimestamps();
14
    }
15
16
    /**
17
     * Get Team Name.
18
     *
19
     * @return mixed|string
20
     */
21
    public function getNameAttribute()
22
    {
23
        return ($this->hasAttribute('name')) ? $this->attributes['name'] : '';
24
    }
25
    /**
26
     * @return null|string
27
     */
28
    public function getFullName()
29
    {
30
        return $this->name;
31
    }
32
33
34
    public function hasAttribute($attr)
35
    {
36
        return array_key_exists($attr, $this->attributes);
37
    }
38
}
39