ApiController.php 867 B

1234567891011121314151617181920212223242526272829303132
  1. <?php
  2. namespace App\Admin\Controllers;
  3. use App\Model\DeviceBox;
  4. use App\Model\DeviceInfo;
  5. use Encore\Admin\Controllers\AuthController as BaseAuthController;
  6. use Illuminate\Http\Request;
  7. class ApiController extends BaseAuthController
  8. {
  9. public function get_box(Request $request)
  10. {
  11. $id = $request->get('q');
  12. $device = DeviceInfo::where('id',$id)->first();
  13. $box_type = [
  14. ['text'=>'一号箱','id'=>1],
  15. ['text'=>'二号箱','id'=>2],
  16. ['text'=>'三号箱','id'=>3],
  17. ['text'=>'四号箱','id'=>4],
  18. ['text'=>'五号箱','id'=>5],
  19. ['text'=>'六号箱','id'=>6],
  20. ];
  21. if($device->device_type == 1){
  22. array_pop($box_type);
  23. }
  24. return $box_type;
  25. }
  26. }