30 lines
		
	
	
		
			877 B
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			30 lines
		
	
	
		
			877 B
		
	
	
	
		
			PHP
		
	
	
	
<?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.weekday_id")
 | 
						|
            ->join("games", "schedules.game_id", "=", "games.game_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("weekday_id", "=", 1)
 | 
						|
            ->orWhere("weekday_id", "=", 7)
 | 
						|
            ->get();
 | 
						|
        return $minmaxDates;
 | 
						|
    }
 | 
						|
}
 |