Skip to content

Instantly share code, notes, and snippets.

@maciejmiara
Created February 25, 2019 21:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save maciejmiara/d36e8a566cd253010600ed80b3d7e880 to your computer and use it in GitHub Desktop.
Save maciejmiara/d36e8a566cd253010600ed80b3d7e880 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