Skip to content

Instantly share code, notes, and snippets.

@tsh-code
Forked from maciejmiara/RunParticipation.php
Created March 11, 2019 09:47
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/d54ae48e4a23c2be3aeefade6f0af0fe to your computer and use it in GitHub Desktop.
Save tsh-code/d54ae48e4a23c2be3aeefade6f0af0fe 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