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

    # define table
    protected $table = 'game_rates';

    # define fillable fields
    protected $fillable = [
        'user_id',
        'stores_id',
        'game_id',
        'game_group_id',
        'day_id',
        'open_time',
        'close_time',
        'rate',
        'status',
        'rate_type',

    ];

    /**
     * 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 RateType()
    {
        return $this->hasOne(new RateType(), 'id', 'rate_type');
    }
    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');
    }
}
