<?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 NewGame extends Model
{
     use Notifiable , SoftDeletes;

 # define table
  protected $table ='new_games';
  
  # define fillable fields
  protected $fillable = [
  	                   'user_id',
  	                   'game_group_id',
  	                   'name',
                      'type',
  	                   'status',
                       
  ];

     /**
   * The attributes that should be cast.
   *
   * @var array
   */
  protected $casts = [
      'status'  => 'boolean',
  ];
  public function gameGroup()
    {
       return $this->hasOne(new GameGroup(), 'id', 'game_group_id');
    }
    
    public function gameRate()
    {
       return $this->hasOne(new GameRate(), 'game_id', 'id');
    }
    
    public function StoreGame()
    {
       return $this->hasMany(new StoreGame(), 'game_id', 'id');
    }
     public function bit()
    {
       return $this->hasMany(new Bit(), 'game_id', 'id');
    }
}
