public function adminSection() { $adminId = Session::get('admin_id'); if (!isset($adminId)) { return Redirect::to('/'); } $orderCount = Order::where('status', '=', 'pending')->count(); $userCount = User::where('status', '=', 'active')->count(); $softwareUserCount = SoftwareUser::where('status', '=', 'active')->count(); $complaintCount = Complaint::whereIn('status', array('Complaint', 'Problem'))->count(); return View::make('admin.admin-section')->with('orderCount', $orderCount)->with('userCount', $userCount)->with('complaintCount', $complaintCount)->with('softwareUserCount', $softwareUserCount); }
public function pendingComplaints($page = 1) { $adminId = Session::get('admin_id'); if (!isset($adminId)) { return json_encode(array('message' => 'not logged')); } $complaints = Complaint::whereIn('status', array('Problem', 'Complaint'))->get(); $userType = Session::get('user_type'); if (!$userType) { $userType = ''; } if (isset($complaints) && count($complaints) > 0) { return json_encode(array('message' => 'found', 'userType' => $userType, 'complaints' => $complaints->toArray())); } else { return json_encode(array('message' => 'empty')); } }