public function query() { $uid = $this->userid ? $this->userid : 0; $datas = VideoModel::where('del', 0)->where('uid', $uid)->orderBy('id', 'desc')->paginate($this->limit); $datas->limit = $this->limit; return $datas; }
/** * 视频 */ public function videos($uid = null) { if ($uid) { $datas = VideoModel::where('del', 0)->where('uid', $uid)->get(); } else { $datas = VideoModel::where('del', 0)->get(); } return $datas; }
public function insertVideo(Request $request, $id) { if (!$request->pic_id || !$request->link) { echo "<script>alert('图片、视频信息必填选!');history.go(-1);</script>"; exit; } if (!strstr($request->link, '?') || !strstr($request->link, '&')) { echo "<script>alert('视频信息格式不对!');history.go(-1);</script>"; exit; } $links = explode('?', $request->link); $orderProModel = OrderProductModel::find($id); $time = time(); $data = ['uid' => $orderProModel->uid, 'name' => $orderProModel->getProductName(), 'url' => $links[0], 'url2' => $links[1], 'pic_id' => $request->pic_id, 'created_at' => $time]; VideoModel::create($data); $videoModel = VideoModel::where($data)->first(); return $videoModel; }
public function query($del) { $datas = VideoModel::where('del', $del)->where('uid', \Session::get('user.uid'))->paginate($this->limit); $datas->limit = $this->limit; return $datas; }