Esempio n. 1
0
 public function subscriberCounterStat()
 {
     $count = 0;
     $subscriber = Group::where('name', 'LIKE', '%ubscrib%')->first();
     if ($subscriber) {
         $related = Groups::getRelationProvider()->createModel()->where('group_id', '=', $subscriber->id);
         $count = count($related->get());
     }
     $this->widgetData = array('count' => $count);
     $this->setupWidgetLayout(__METHOD__);
 }
 /**
  * Brand Removal
  *
  * @AclMap(name="user_brand_removal",config={"except":"banned,guest"},insufficient_message="acl.login")
  */
 public function deleteBrandRemoval()
 {
     $user_from_auth = Auth::user();
     if (!$user_from_auth) {
         App::abort(404);
     }
     $user = User::find((int) $user_from_auth->id);
     if (!$user) {
         App::abort(404);
     }
     $brand_id = Input::get('brand_id');
     if (empty($brand_id)) {
         return Response::json(array('message' => 'Invalid brand.'));
     }
     $status = Groups::getRelationProvider()->removeUserFromBrand($user->id, $brand_id);
     $user->brandSwitch(0);
     return Response::json(array('message' => 'Removed from brand.'));
 }