ldc-gen-game-web/app/Models/Participation.php

43 lines
850 B
PHP
Raw Normal View History

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Participation extends Model
{
2021-08-18 17:08:02 +02:00
protected $table = "participation";
2021-08-18 17:08:02 +02:00
public function user()
{
return $this->belongsTo('App\User', 'user_id');
}
2021-08-18 17:08:02 +02:00
public function code()
{
return $this->belongsTo('App\Models\Codes', 'code_unique_id');
}
2021-08-18 17:08:02 +02:00
public function code_ean()
{
return $this->belongsTo('App\Models\CodesEAN', 'code_ean_id');
}
2021-08-18 17:08:02 +02:00
public function instant_win()
{
return $this->hasOne('App\Models\InstantWin', 'participation_id');
}
2021-08-18 17:08:02 +02:00
public function reduction()
{
return $this->hasOne('App\Models\Reductions', 'reduction_id');
}
2021-08-18 17:08:02 +02:00
public function getCodeEanValueAttribute()
{
$code = CodesEAN::find($this->code_ean_id)->code;
return $code;
}
}