<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
use Illuminate\Database\Eloquent\SoftDeletes;
use Illuminate\Foundation\Auth\User as Authenticatable;
use App\Models\Day;

class ChakriBets extends Model
{
    use Notifiable, SoftDeletes;

    # define table
    protected $table = 'chakri_bets';

    # define fillable fields
    protected $fillable = [
        'period_id',
        'game_id',
        'user_id',
        'bet_id',
        'bet_place',
        'amount',
        'status',

    ];

    /**
     * The attributes that should be cast.
     *
     * @var array
     */
    protected $casts = [
        'status'  => 'boolean',
    ];

    public function period()
    {
        return $this->hasOne(new ChakriPeriods(), 'id', 'period_id');
    }

    public function user()
    {
        return $this->hasOne(new Users(), 'id', 'user_id');
    }

    public function game()
    {
        return $this->hasOne(new ChakriGames(), 'id', 'game_id');
    }
}
