Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Forked from maciejmiara/Runner.php
Created March 11, 2019 09:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsh-code/b0d025b1cea4266b80a33a404b8e689e to your computer and use it in GitHub Desktop.
Save tsh-code/b0d025b1cea4266b80a33a404b8e689e to your computer and use it in GitHub Desktop.
Eloquent runner model
<?php
namespace Infrastructure\Eloquent\Model;
use Illuminate\Database\Eloquent\Model;
use Infrastucture\Eloquent\Model\RunResult;
class Runner extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'id',
'email',
'password',
];
/**
* The attributes that should be hidden for arrays.
*
* @var array
*/
protected $hidden = [
'password'
];
/**
* @var string
*/
protected $table = 'runners';
/**
* @var string
*/
protected $keyType = 'string';
/**
* @var bool
*/
public $timestamps = false;
/**
* @var bool
*/
public $incrementing = false;
public function participations()
{
return $this->hasMany(RunParticipation::class);
}
public function results()
{
return $this->hasMany(RunResult::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment