Lae/app/Http/Controllers/Admin/DeviceController.php

48 lines
1.0 KiB
PHP
Raw Normal View History

2022-11-28 14:54:00 +00:00
<?php
namespace App\Http\Controllers\Admin;
use App\Http\Controllers\Controller;
use App\Support\EmqxSupport;
use Illuminate\Http\Request;
2022-11-28 15:14:48 +00:00
use Illuminate\Pagination\Paginator;
2022-11-28 14:54:00 +00:00
class DeviceController extends Controller
{
//
public function index(Request $request)
{
$emqx = new EmqxSupport();
2022-11-28 15:14:48 +00:00
$clients = $emqx->clients([
'clientid' => $request->client_id,
'username' => $request->username,
'page' => $request->page,
]);
2022-11-28 14:54:00 +00:00
2022-11-28 15:14:48 +00:00
// dd($clients);
2022-11-28 14:54:00 +00:00
return view('admin.device.index', compact('clients'));
}
//
// public function show(Request $request, $client_id)
// {
// $emqx = new EmqxSupport();
//
// $client = $emqx->clients(['clientid' => $client_id]);
//
// return view('admin.device.show', compact('client'));
// }
public function destroy($client_id)
{
$emqx = new EmqxSupport();
$emqx->kickClient($client_id);
return back()->with('success', '此客户端已下线。');
}
}