<?php
namespace App\Http\Controllers;
use App\Path;
use App\Car;
use App\People;
use GuzzleHttp\Client;
use Illuminate\Support\Facades\Auth;
class PageController extends Controller
{
    public function page()
    {
        $query = Path::all();
  
        $main=Car::all();

        return View('index',['page' => 'page','result'=>$query,'iresult'=>$main,'navbar_li'=>'layouts.navbar_li','title'=>'首頁']);
    }

    public function car_sys()
    {
        if(Auth::check())
        {
            return '登入';
        }
        else{
            $query = Path::all();
            return View('index',['page' => 'car_sys','result'=>$query]);
        }
        
    }
    
    public function video_replay()
    {
        $query = Path::all();
  
        $main=Car::all();
        return View('index',['page' => 'video_replay.index','result'=>$query,'iresult'=>$main,'navbar_li'=>'video_replay.layout.navbar_li','title'=>'tt']);
    }
    public function HRM()
    {
        $query = Path::all();
  
        $main=Car::all();
        return View('index',['page' => 'HRM.HRM','result'=>$query,'iresult'=>$main,'navbar_li'=>'layouts.navbar_li','title'=>'tt']);
    }
    public function new()
    {
        $query = Path::all();
  
        $main=Car::all();
        $client = new \GuzzleHttp\Client();
        $easy_darw="192.168.5.208:10008";
        $res = $client->GET($easy_darw."/api/v1/players");
        $response = json_decode($res->getBody()->__toString(), true);
        $total_stream=$response['rows'];
        
        $res = $client->GET("192.168.5.222:2375"."/images/json");
        $response = json_decode($res->getBody()->__toString(), true);
        $docker_tag=$response;
        return View('index',['page' => 'new','result'=>$query,'iresult'=>$main,'navbar_li'=>'layouts.navbar_li','docker_tag'=>$docker_tag,'total_stream'=>$total_stream,'title'=>'tt']);
    }
    public function service()
    {
        $query = Path::all();
  
        $main=Car::all();
        return View('index',['page' => 'service','result'=>$query,'iresult'=>$main,'navbar_li'=>'layouts.navbar_li','title'=>'tt']);
    }
    public function people()
    {
        $query = Path::all();
  
        $main=Car::all();
        $people=People::all();
        return View('index',['page' => 'people','result'=>$query,'iresult'=>$main,'people'=>$people,'navbar_li'=>'video_replay.layout.navbar_li','title'=>'tt']);
    }
    public function test()
    {
        $query = Path::all();
  
        $main=Car::all();
        $people=People::all();
        return View('index',['page' => 'test','result'=>$query,'iresult'=>$main,'people'=>$people,'navbar_li'=>'video_replay.layout.navbar_li','title'=>'tt']);
    }
    public function line()
    {
        $query = Path::all();
  
        $main=Car::all();
        return View('index',['page' => 'line.line','result'=>$query,'iresult'=>$main,'navbar_li'=>'layouts.navbar_li','title'=>'tt']);
    }
}