2021-04-02 19:48:41 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Controllers;
|
|
|
|
|
|
|
|
|
|
use App\Http\Resources\AgentAllowResource;
|
|
|
|
|
use App\Models\AgentAllow;
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
|
|
|
|
|
class AgentAllowController extends Controller
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Display a listing of the resource.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
|
|
|
|
public function index()
|
|
|
|
|
{
|
2021-04-16 19:04:01 +08:00
|
|
|
$result = AgentAllow::query()->orderBy('id', 'desc')->paginate();
|
2021-04-02 19:48:41 +08:00
|
|
|
$resource = AgentAllowResource::collection($result);
|
2021-04-19 20:13:21 +08:00
|
|
|
return $this->success($resource);
|
2021-04-02 19:48:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Store a newly created resource in storage.
|
|
|
|
|
*
|
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
|
* @return \Illuminate\Http\Response
|
|
|
|
|
*/
|
|
|
|
|
public function store(Request $request)
|
|
|
|
|
{
|
|
|
|
|
//
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Display the specified resource.
|
|
|
|
|
*
|
|
|
|
|
* @param int $id
|
2021-04-16 19:04:01 +08:00
|
|
|
* @return array
|
2021-04-02 19:48:41 +08:00
|
|
|
*/
|
|
|
|
|
public function show($id)
|
|
|
|
|
{
|
2021-04-16 19:04:01 +08:00
|
|
|
$result = AgentAllow::query()->findOrFail($id);
|
|
|
|
|
$resource = new AgentAllowResource($result);
|
2021-04-19 20:13:21 +08:00
|
|
|
return $this->success($resource);
|
2021-04-02 19:48:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Update the specified resource in storage.
|
|
|
|
|
*
|
|
|
|
|
* @param \Illuminate\Http\Request $request
|
|
|
|
|
* @param int $id
|
2021-04-16 19:04:01 +08:00
|
|
|
* @return array
|
2021-04-02 19:48:41 +08:00
|
|
|
*/
|
|
|
|
|
public function update(Request $request, $id)
|
|
|
|
|
{
|
2021-04-16 19:04:01 +08:00
|
|
|
$result = AgentAllow::query()->findOrFail($id);
|
|
|
|
|
$result->update($request->all());
|
|
|
|
|
$resource = new AgentAllowResource($result);
|
2021-04-19 20:13:21 +08:00
|
|
|
return $this->success($resource);
|
2021-04-02 19:48:41 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Remove the specified resource from storage.
|
|
|
|
|
*
|
|
|
|
|
* @param int $id
|
2021-04-16 19:04:01 +08:00
|
|
|
* @return array
|
2021-04-02 19:48:41 +08:00
|
|
|
*/
|
|
|
|
|
public function destroy($id)
|
|
|
|
|
{
|
2021-04-16 19:04:01 +08:00
|
|
|
$result = AgentAllow::query()->findOrFail($id);
|
|
|
|
|
$deleted = $result->delete();
|
2021-04-19 20:13:21 +08:00
|
|
|
return $this->success([$deleted]);
|
2021-04-02 19:48:41 +08:00
|
|
|
}
|
|
|
|
|
}
|