2020-10-21 15:26:21 +02:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Models;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Database\Eloquent\Model;
|
|
|
|
|
|
|
|
|
|
class InstantWin extends Model
|
|
|
|
|
{
|
2022-01-11 12:39:28 +01:00
|
|
|
/**
|
|
|
|
|
* Indicates if the model should be timestamped.
|
|
|
|
|
*
|
|
|
|
|
* @var boolean
|
|
|
|
|
*/
|
2020-10-21 15:26:21 +02:00
|
|
|
public $timestamps = false;
|
2021-08-18 17:08:02 +02:00
|
|
|
|
2022-01-11 12:39:28 +01:00
|
|
|
/**
|
|
|
|
|
* The relations to eager load on every query.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
2020-10-21 15:26:21 +02:00
|
|
|
protected $with = ['prize'];
|
|
|
|
|
|
2022-01-11 12:39:28 +01:00
|
|
|
/**
|
|
|
|
|
* The attributes that should be cast to native types.
|
|
|
|
|
*
|
|
|
|
|
* @var array
|
|
|
|
|
*/
|
|
|
|
|
protected $casts = [
|
|
|
|
|
'won' => 'bool'
|
|
|
|
|
];
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* BelongsTo Prize relation
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
|
|
|
|
|
*/
|
2021-08-18 17:08:02 +02:00
|
|
|
public function prize()
|
|
|
|
|
{
|
2022-01-11 12:39:28 +01:00
|
|
|
return $this->belongsTo(Prize::class, 'prize_id');
|
2020-10-21 15:26:21 +02:00
|
|
|
}
|
2020-11-04 11:49:43 +01:00
|
|
|
|
2022-01-11 12:39:28 +01:00
|
|
|
/**
|
|
|
|
|
* One to one relation participation
|
|
|
|
|
*
|
|
|
|
|
* @return \Illuminate\Database\Eloquent\Relations\HasOne
|
|
|
|
|
*/
|
2021-08-18 17:08:02 +02:00
|
|
|
public function participation()
|
|
|
|
|
{
|
2022-01-11 12:39:28 +01:00
|
|
|
return $this->belongsTo(Participation::class);
|
2020-11-04 11:49:43 +01:00
|
|
|
}
|
2020-10-21 15:26:21 +02:00
|
|
|
}
|