with('stationType','owner')->orderByDesc('id')->paginate($request['paginate'] ?? 50); $owners = $ownerService->getAuthorizedOwners(); return view('station.rule.index',compact('stationRuleBatches','owners')); } /** * store API * @param StationRuleBatchRequest $request */ public function storeApi(StationRuleBatchRequest $request) { $this->gate('站管理-站规则-编辑'); $stationRuleBatch = StationRuleBatch::query()->create($request->only(['name','owner_id'])); $stationRuleBatch->load('stationType','owner'); $this->success($stationRuleBatch); } /** * update API * @param StationRuleBatchRequest $request */ public function updateApi(StationRuleBatchRequest $request) { $this->gate('站管理-站规则-编辑'); $stationRuleBatch = StationRuleBatch::query()->whereKey($request['id'])->first(); $stationRuleBatch->update($request->all()); $stationRuleBatch->load('stationType','owner'); $this->success($stationRuleBatch); } public function destroyApi(Request $request) { $this->gate('站管理-站规则-删除'); StationRuleBatch::query()->whereKey($request['id'])->delete(); $this->success(); } /** * Show the form for creating a new resource. * * @return Response */ public function create() { // } /** * Store a newly created resource in storage. * * @param \Illuminate\Http\Request $request * @return Response */ public function store(Request $request) { // } /** * Display the specified resource. * * @param \App\StationRuleBatch $stationRuleBatch * @return Response */ public function show(StationRuleBatch $stationRuleBatch) { // } /** * Show the form for editing the specified resource. * * @param \App\StationRuleBatch $stationRuleBatch * @return Response */ public function edit(StationRuleBatch $stationRuleBatch) { // } /** * Update the specified resource in storage. * * @param \Illuminate\Http\Request $request * @param \App\StationRuleBatch $stationRuleBatch * @return Response */ public function update(Request $request, StationRuleBatch $stationRuleBatch) { // } /** * Remove the specified resource from storage. * * @param \App\StationRuleBatch $stationRuleBatch * @return Response */ public function destroy(StationRuleBatch $stationRuleBatch) { // } }