<?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;

class UserWinnersAmount extends Model
{
     use Notifiable , SoftDeletes;

 # define table
  protected $table ='user_winners_amount';
  
  # define fillable fields
  protected $fillable = [
                       'game_winners_id',
  	                   'user_id',
  	                   'stores_id',
                       'game_id',
                       'game_group_id',
  	                   'day_id',
  	                   'sssssss',
                       'open_time',
  	                   'close_time',
  	                   'amount',
  	                   'status',
  	                   'type',
                       'payment_status',
                       'payment_new_history_id', // payment_new_history id for bet remark
                       'win_pay_id', // payment_new_history id for win remark
                       'created_at',
                       
  ];

     /**
   * The attributes that should be cast.
   *
   * @var array
   */
  protected $casts = [
      'status'  => 'boolean',
  ];
   public function Day()
    {
        return $this->hasOne(new Day(), 'id', 'day_id');
    }
     public function Game()
    {
        return $this->hasMany(new Game(), 'id', 'game_id');
    }
    public function GameName()
    {
        return $this->hasOne(new Game(), 'id', 'game_id');
    }
    public function Stores()
    {
        return $this->hasOne(new Store(), 'id', 'stores_id');
    }
    public function GameGroupName()
    {
        return $this->hasOne(new GameGroup(), 'id', 'game_group_id');
    }
    public function username()
    {
       
        return $this->hasOne('App\User', 'id', 'user_id');
    }
    public function gameWinner()
    {
       
         return $this->hasOne(new GameWinner(), 'id', 'game_winners_id');
    }
    public function paymentNewHistory()
    {
       
         return $this->hasOne(new PaymentNewHistory(), 'id', 'payment_new_history_id');
    }
}
