mirror of
https://github.com/lkddi/nexusphp.git
synced 2026-04-23 19:37:23 +08:00
agent allow store + update + delete
This commit is contained in:
@@ -15,7 +15,7 @@ class AgentAllowController extends Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$result = AgentAllow::query()->paginate();
|
||||
$result = AgentAllow::query()->orderBy('id', 'desc')->paginate();
|
||||
$resource = AgentAllowResource::collection($result);
|
||||
return success('agent allow list', $resource);
|
||||
}
|
||||
@@ -35,11 +35,13 @@ class AgentAllowController extends Controller
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return array
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
$result = AgentAllow::query()->findOrFail($id);
|
||||
$resource = new AgentAllowResource($result);
|
||||
return success('agent allow detail', $resource);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -47,21 +49,26 @@ class AgentAllowController extends Controller
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return array
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
$result = AgentAllow::query()->findOrFail($id);
|
||||
$result->update($request->all());
|
||||
$resource = new AgentAllowResource($result);
|
||||
return success('agent allow update', $resource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
* @return array
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
$result = AgentAllow::query()->findOrFail($id);
|
||||
$deleted = $result->delete();
|
||||
return success('agent allow delete', [$deleted]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@ class AgentAllowResource extends JsonResource
|
||||
{
|
||||
return [
|
||||
'id' => $this->id,
|
||||
'family' => $this->family,
|
||||
'start_name' => $this->start_name,
|
||||
'peer_id_pattern' => $this->peer_id_pattern,
|
||||
'peer_id_match_num' => $this->peer_id_match_num,
|
||||
@@ -27,6 +28,7 @@ class AgentAllowResource extends JsonResource
|
||||
'agent_start' => $this->agent_start,
|
||||
'exception' => $this->exception,
|
||||
'comment' => $this->comment,
|
||||
'allowhttps' => $this->allowhttps,
|
||||
'hits' => $this->hits,
|
||||
];
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ class AgentAllow extends NexusModel
|
||||
protected $table = 'agent_allowed_family';
|
||||
|
||||
protected $fillable = [
|
||||
'family', 'start_name', 'exception', 'allowhttps', 'comment', 'hits',
|
||||
'family', 'start_name', 'exception', 'allowhttps', 'comment',
|
||||
'peer_id_pattern', 'peer_id_match_num', 'peer_id_matchtype', 'peer_id_start',
|
||||
'agent_pattern', 'agent_match_num', 'agent_matchtype', 'agent_start',
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user