Skip to content

Instantly share code, notes, and snippets.

@maciejmiara
Created February 25, 2019 21:57
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/cf24dad9e7719be506ee8552ecea8745 to your computer and use it in GitHub Desktop.
Save maciejmiara/cf24dad9e7719be506ee8552ecea8745 to your computer and use it in GitHub Desktop.
Eloquent run participation model
<?php
namespace Infrastructure\Eloquent\Model;
use Illuminate\Database\Eloquent\Model;
class RunParticipation extends Model
{
/**
* The attributes that are mass assignable.
*
* @var array
*/
protected $fillable = [
'runner_id',
'run_id',
];
/**
* @var string
*/
protected $table = 'run_participations';
/**
* @var string
*/
protected $keyType = 'string';
/**
* @var bool
*/
public $timestamps = false;
/**
* @var bool
*/
public $incrementing = false;
public function runner()
{
return $this->belongsTo(Runner::class);
}
public function run()
{
return $this->belongsTo(Run::class);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment