<?php
/*
 本代码由 口号帮 创建
 创建时间 2019-05-08 16:22:09
 技术支持 口号帮 
 严禁反编译、逆向等任何形式的侵权行为，违者将追究法律责任
*/

namespace App\Http\Controllers\Admin;use App\Http\Requests\HelpRequest;use App\Models\Help;use Illuminate\Http\Request;use App\Http\Controllers\Controller;class HelpController extends Controller{public function index(){return view('admin.website.help.index');}public function data(Request $request,Help $help){$model=$help->query();$res=$model->orderBy('created_at','desc')->paginate($request->get('limit',30))->toArray();$P2gAC0=array();$P2gAC0['code']=0;$P2gAC0['msg']='正在请求中...';$P2gAC0['count']=$res['total'];$P2gAC0['data']=$res['data'];$data=$P2gAC0;return response()->json($data);}public function create(){return view('admin.website.help.create');}public function store(HelpRequest $request,Help $help){$data=$request->all();$help->create($data);return redirect()->route('admin.website.help')->with('status','帮助添加成功！');}public function show($id){}public function edit($id){$help=Help::find($id);return view('admin.website.help.edit',compact('help'));}public function update(HelpRequest $request,$id){$article=Help::findOrFail($id);$data=$request->all();if($article->update($data))goto P2gBodyx2;goto P2gNextx2;P2gBodyx2:return redirect(route('admin.website.help'))->with(['status'=>'更新成功']);goto P2gx1;P2gNextx2:P2gx1:return redirect(route('admin.website.help'))->withErrors(['status'=>'系统错误']);}public function destroy(Request $request){$ids=$request->get('ids');if(empty($ids))goto P2gBodyx4;goto P2gNextx4;P2gBodyx4:return response()->json(['code'=>1,'msg'=>'请选择删除项']);goto P2gx3;P2gNextx4:P2gx3:foreach(Help::whereIn('id',$ids)->get()as $model){$model->delete();}return response()->json(['code'=>0,'msg'=>'删除成功']);}}
?>