Beispiel #1
0
 public function getIndex(Request $req)
 {
     $user = $req->user();
     if ($user->admin) {
         return Weixin::orderBy('priority', 'desc')->paginate(10);
     }
     return Weixin::whereNull('marking')->orWhere(['id' => $user->last_wx, 'marking' => 0])->orderBy('priority', 'desc')->paginate(10);
 }
Beispiel #2
0
 public function getIndex(Request $req)
 {
     $user = $req->user();
     $marked = DB::table('user_marked')->where('user_id', $user->id)->count();
     $total = $unmarked = 0;
     if (!Session::get('total_wx_count')) {
         Session::set('total_wx_count', Weixin::count());
         Session::set('unmarked_wx_count', Weixin::whereNull('marking')->orWhere('marking', 0)->count());
     }
     $total = Session::get('total_wx_count');
     $unmarked = Session::get('unmarked_wx_count');
     return ['me' => $marked, 'total' => $total, 'unmarked' => $unmarked, 'marked' => $total - $unmarked, 'pending' => Weixin::where('marking', 0)->count()];
 }