Ejemplo n.º 1
0
 public function query($index)
 {
     $uid = $this->userid ? $this->userid : 0;
     //1click,2collect,3follow,4reply,5share,6thank
     if ($index) {
         if ($index == 1) {
             $models = TalksClickModel::where('uid', $uid)->get();
         } elseif ($index == 2) {
             $models = TalksCollectModel::where('uid', $uid)->get();
         } elseif ($index == 3) {
             $models = TalksFollowModel::where('uid', $uid)->get();
         } elseif ($index == 4) {
             $models = TalksReportModel::where('uid', $uid)->get();
         } elseif ($index == 5) {
             $models = TalksShareModel::where('uid', $uid)->get();
         } elseif ($index == 6) {
             $models = TalksThankModel::where('uid', $uid)->get();
         }
         $ids = array();
         if (isset($models) && count($models)) {
             foreach ($models as $model) {
                 $ids[] = $model->talkid;
             }
         }
         $datas = TalksModel::whereIn('id', $ids)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     } else {
         $datas = TalksModel::where('uid', $uid)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit);
     }
     $datas->limit = $this->limit;
     return $datas;
 }
Ejemplo n.º 2
0
 /**
  * 点赞话题
  */
 public function toclick($id)
 {
     $msg = '不能点赞自己的话题';
     TalksClickModel::create($this->tolimit($id, $msg));
     return redirect('/talk/follow');
 }
Ejemplo n.º 3
0
 /**
  * 点击话题
  */
 public function click()
 {
     $datas = TalksClickModel::where('talkid', $this->id)->get();
     return count($datas) ? $datas : 0;
 }