for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Xoco70\LaravelTournaments\Models;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User;
class Competitor extends Fighter
{
use SoftDeletes;
protected $DATES = ['created_at', 'updated_at', 'deleted_at'];
protected $table = 'competitor';
public $timestamps = true;
protected $fillable = [
'tournament_category_id',
'user_id',
'confirmed',
];
/**
* Get User from Competitor.
*
* @return mixed
*/
public function user()
return $this->belongsTo(User::class);
}
* @return null|string
public function getNameAttribute()
return $this->defaultName() ?? $this->user->name;
public function getFullName() //TODO Should remove get prefix
return $this->defaultName() ?? $this->user->firstname . " " . $this->user->lastname;
private function defaultName()
if ($this == null || $this->user == null) {
return "";
return null;