Пример #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;
 }
Пример #2
0
 /**
  * 感谢话题
  */
 public function tothank($id)
 {
     $msg = '不能感谢自己的话题';
     TalksThankModel::create($this->tolimit($id, $msg));
     return redirect('/talk/follow');
 }
Пример #3
0
 /**
  * 感谢话题
  */
 public function thank()
 {
     $datas = TalksThankModel::where('talkid', $this->id)->get();
     return count($datas) ? $datas : 0;
 }