92 lines
1.9 KiB
PHP
92 lines
1.9 KiB
PHP
<?php
|
|
namespace App\Domains\Virtual\Http\Controllers;
|
|
|
|
use App\Core\Controller;
|
|
use Illuminate\Http\Request;
|
|
use App\Domains\Virtual\Services\FlowPoolService;
|
|
use App\Domains\Real\Repositories\FlowPoolRepository as RealFlowPoolRepository;
|
|
|
|
class FlowPoolController extends Controller
|
|
{
|
|
protected $request;
|
|
protected $flowPoolService;
|
|
|
|
/**
|
|
* 构造函数,自动注入.
|
|
*/
|
|
public function __construct(Request $request, FlowPoolService $flowPoolService)
|
|
{
|
|
$this->request = $request;
|
|
$this->flowPoolService = $flowPoolService;
|
|
}
|
|
|
|
/**
|
|
* RD流量池列表
|
|
*
|
|
* @return void
|
|
*/
|
|
public function real()
|
|
{
|
|
$list = app(RealFlowPoolRepository::class)->get();
|
|
return res($list, 'RD流量池列表', 201);
|
|
}
|
|
|
|
/**
|
|
* 列表.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function index()
|
|
{
|
|
$conditions = $this->request->all();
|
|
|
|
$flowPools = $this->flowPoolService->index($conditions);
|
|
|
|
return res($flowPools, '流量池列表', 201);
|
|
}
|
|
|
|
|
|
/**
|
|
* 创建.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function create()
|
|
{
|
|
$attributes = $this->request->all();
|
|
|
|
$flowPool = $this->flowPoolService->store($attributes);
|
|
|
|
return res($flowPool, '创建成功');
|
|
}
|
|
|
|
/**
|
|
* 编辑.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function update($id)
|
|
{
|
|
$attributes = $this->request->all();
|
|
$attributes['id'] = $id;
|
|
|
|
$flowPool = $this->flowPoolService->store($attributes);
|
|
|
|
return res($flowPool, '修改成功');
|
|
}
|
|
|
|
/**
|
|
* 删除.
|
|
*
|
|
* @return \Illuminate\Http\Response
|
|
*/
|
|
public function destroy()
|
|
{
|
|
$ids = $this->request->ids();
|
|
|
|
$this->flowPoolService->destroy($ids);
|
|
|
|
return res(true, '删除成功');
|
|
}
|
|
}
|