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

61 lines
1.3 KiB
PHP
Raw Normal View History

2020-10-21 15:26:21 +02:00
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* InstantWin.
*
* @property-read \Illuminate\Support\Carbon $appear_date Appear date
2023-08-24 12:59:51 +00:00
* @property boolean $won Is the prize won ?
*
2023-11-21 12:28:09 +01:00
* @property-read \App\Models\Prize $prize Associated prize.
* @property-read \App\Models\Participation $participation Associated participation.
*/
2020-10-21 15:26:21 +02:00
class InstantWin extends Model
{
/**
* 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
/**
* The relations to eager load on every query.
*
* @var array
*/
2020-10-21 15:26:21 +02:00
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
*/
2021-08-18 17:08:02 +02:00
public function prize()
{
return $this->belongsTo(Prize::class, 'prize_id');
2020-10-21 15:26:21 +02:00
}
/**
* One to one relation participation
*
* @return \Illuminate\Database\Eloquent\Relations\HasOne
*/
2021-08-18 17:08:02 +02:00
public function participation()
{
return $this->belongsTo(Participation::class);
}
2020-10-21 15:26:21 +02:00
}