ldc-gen-game-web/app/Models/InstantWin.php
2023-11-21 12:28:09 +01:00

60 lines
1.3 KiB
PHP

<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* InstantWin.
*
* @property-read \Illuminate\Support\Carbon $appear_date Appear date
* @property boolean $won Is the prize won ?
*
* @property-read \App\Models\Prize $prize Associated prize.
* @property-read \App\Models\Participation $participation Associated participation.
*/
class InstantWin extends Model
{
/**
* Indicates if the model should be timestamped.
*
* @var boolean
*/
public $timestamps = false;
/**
* The relations to eager load on every query.
*
* @var array
*/
protected $with = ['prize'];
/**
* The attributes that should be cast to native types.
*
* @var array
*/
protected $casts = [
'won' => 'bool'
];
/**
* BelongsTo Prize relation
*
* @return \Illuminate\Database\Eloquent\Relations\BelongsTo
*/
public function prize()
{
return $this->belongsTo(Prize::class, 'prize_id');
}
/**
* One to one relation participation
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
public function participation()
{
return $this->belongsTo(Participation::class);
}
}