where('is_show', 1)->where('pid', 0)->orderBy('rank','DESC')->get()->toArray(); $condition['keywords'] = $request->input('keywords', ''); $condition['category_id'] = $request->input('category_id', 0); // $condition['platform'] = 'psy_center'; $condition['type'] = 3; $condition['platform'] = 'psy_center'; $video = $service->getList($condition); // var_dump($video);exit; // print_r($category);exit; return view('psycenter.video', ['categories'=>$category, 'video'=>$video,'condition'=>$condition, 'title'=>'视频']); } public function store(VideoRequest $request) { $category = new Video(); $request->merge(['type' => 3]); $request->merge(['platform'=>'psy_center']); if ($request->has('id')){ $category = Video::find($request->input('id')); $result = $category->fill($request->all()); $res = $result->save(); }else{ $result = $category->fill($request->all()); $res = $result->save(); } return $res ? $this->success($result) : $this->failed('保存失败'); } public function show($id) { $video = Video::where('id', $id)->firstOrFail(); return $this->success($video); } public function destroy($id) { Video::where('id', $id)->firstOrFail(); $res = Video::destroy($id); if($res) { return $this->success(''); }else { return $this->failed('删除失败'); } } public function delete() { $ids = request()->input('ids'); $res = Video::whereIn('id', $ids)->delete(); if($res) { return $this->success(''); }else { return $this->failed('删除失败'); } } }