| 1 | <?php |
||
| 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) |
||
| 38 | } |
||
| 39 |