<?php

namespace App\Http\Controllers;

use App\Http\Resources\PermissionResource;
use App\Http\Requests\UsersRequest;
use App\Http\Resources\UserResource;
use App\Laravue\JsonResponse;
use App\Laravue\Models\Device;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\ResourceCollection;
use Illuminate\Support\Arr;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Config;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Facades\Redis;
use Validator;

class HuinappHomeController extends controller
{
    //设备详情
    public function deviceDataInfo($id){
        $data = DB::table('device as d')
            ->join('device_type as t','d.dtype','=','t.tid')
            ->join('gas as g','d.status','=','g.id')
            ->join('danwei as  w','d.devicemonad','=','w.id')
            ->join('status as s','d.devicepolice','=','s.id')
            ->join('users as u','d.uid','=','u.id')
            ->where('d.id','=',$id)
            ->select('d.*','t.tname','g.gas','w.danwei','s.status_name','u.username','u.isadmin')
            ->first();
        return $this->jsonSuccessData($data);
    }
}