<?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('page',['result'=>$query,'iresult'=>$main]);
    }

    // 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('video_replay.index',['result'=>$query,'iresult'=>$main]);
    }
    public function HRM()
    {
        $query = Path::all();
        $main=Car::all();
        return View('HRM.HRM',['result'=>$query,'iresult'=>$main]);
    }
    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('docker.new',['result'=>$query,'iresult'=>$main,'docker_tag'=>$docker_tag,'total_stream'=>$total_stream]);
    }
    // public function service()
    // {
    //     $query = Path::all();
  
    //     $main=Car::all();
    //     return View('service',['result'=>$query,'iresult'=>$main]);
    // }
    public function people()
    {
        $query = Path::all();
        $main=Car::all();
        $people=People::all();
        return View('people',['result'=>$query,'iresult'=>$main,'people'=>$people]);
    }
    public function line()
    {
        $query = Path::all();
        $main=Car::all();
        return View('line.line',['result'=>$query,'iresult'=>$main]);
    }
    public function health()
    {
        $query = Path::all();
        $main=Car::all();
        return View('longcare.health',['result'=>$query,'iresult'=>$main]);
    }
}