public function query($uid) { if ($uid) { $datas = ThemeModel::where('uid', $uid)->where('isshow', 1)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit * 2); } else { $datas = ThemeModel::where('isshow', 1)->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit * 2); } $datas->limit = $this->limit; return $datas; }
public function query($uname) { if ($uname && $uname != '本站') { $datas = ThemeModel::where('uname', 'like', '%' . $uname . '%')->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit); } else { $datas = ThemeModel::orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit); } $datas->limit = $this->limit; return $datas; }
/** * 我收藏的话题 */ public function themelist($themeid) { $result = ['datas' => ThemeModel::where(['isshow' => 1, 'themeid' => $themeid])->orderBy('sort', 'desc')->orderBy('id', 'desc')->paginate($this->limit * 2), 'curr' => 'themelist']; return view('home.talk.themelist', $result); }
/** * 话题的主题 */ public function theme() { $themeid = $this->themeid ? $this->themeid : 0; $themeModel = ThemeModel::find($themeid); return $themeModel ? $themeModel : ''; }