<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;
use App\Models\Weekdays;
use App\Models\Game;
use App\Models\Schedule;
use Illuminate\Support\Facades\DB;

class SchedulesController extends Controller
{
    public function index(){
        $finalSchedules = DB::table('schedules')
            ->join('weekdays', "schedules.weekday_id", "=", "weekdays.id")
            ->join("games", "schedules.game_id", "=", "games.id")
            ->select("weekdays.weekday_name", "weekdays.current_date", "games.name", "schedules.stream_time")
            ->get();
        return $finalSchedules;
    }

    public function mmDate(){
        $minmaxDates = DB::table("weekdays")
            ->select("weekdays.current_date")->where("weekdays.id", "=", 1)
            ->orWhere("weekdays.id", "=", 7)
            ->get();
        return $minmaxDates;
    }
}
