<?php


namespace App\Admin\Controllers;


use App\Model\DeviceBox;
use App\Model\DeviceInfo;
use Encore\Admin\Controllers\AuthController as BaseAuthController;
use Illuminate\Http\Request;

class ApiController extends BaseAuthController
{
    public function get_box(Request $request)
    {
        $id = $request->get('q');
        $device = DeviceInfo::where('id',$id)->first();
        $box_type = [
                        ['text'=>'一号箱','id'=>1],
                        ['text'=>'二号箱','id'=>2],
                        ['text'=>'三号箱','id'=>3],
                        ['text'=>'四号箱','id'=>4],
                        ['text'=>'五号箱','id'=>5],
                        ['text'=>'六号箱','id'=>6],
            ];
        if($device->device_type == 1){
            array_pop($box_type);
        }
        return $box_type;
    }

}
