当前位置: 首页>>代码示例>>PHP>>正文


PHP Users::count方法代码示例

本文整理汇总了PHP中app\models\Users::count方法的典型用法代码示例。如果您正苦于以下问题:PHP Users::count方法的具体用法?PHP Users::count怎么用?PHP Users::count使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\Users的用法示例。


在下文中一共展示了Users::count方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: index

 public function index()
 {
     view()->share('menu_item_active', 'index');
     Title::prepend('Dashboard');
     $data = ['title' => Title::renderr(' : ', true), 'posts_total' => Posts::count(), 'posts_active' => Posts::where('status', 'active')->count(), 'posts_draft' => Posts::where('status', 'draft')->count(), 'posts_moderation' => Posts::where('status', 'moderation')->count(), 'users_total' => Users::count(), 'users_active' => Users::where('active', '1')->count(), 'users_inactive' => Users::where('active', '0')->count(), 'latest_posts' => Posts::active()->orderBy('published_at', 'desc')->limit(5)->get(), 'popular_posts' => Posts::active()->orderBy('views', 'desc')->limit(5)->get()];
     return view('root.dashboard.index', $data);
 }
开发者ID:garf,项目名称:0ez,代码行数:7,代码来源:DashboardController.php

示例2: users

 public static function users($parameter = "")
 {
     if ($parameter == "") {
         return Md\Users::count();
     }
     if ($parameter == "cashier") {
         return Md\Users::whereNull('finger_print')->count();
     }
     if ($parameter == "attendance") {
         return Md\Users::whereNotNull('finger_print')->count();
     }
 }
开发者ID:Abdulhmid,项目名称:inventory,代码行数:12,代码来源:DashboardHelp.php

示例3: array

<?php

namespace app\models;

use lithium\util\Validator;
use lithium\util\String;
class Documents extends \lithium\data\Model
{
    protected $_meta = array('connection' => 'default_kyc');
    public $validates = array('email' => array(array('uniqueEmail', 'message' => 'This Email is already used'), array('notEmpty', 'message' => 'Please enter your email address'), array('email', 'message' => 'Not a valid email address')));
}
Validator::add('uniqueEmail', function ($value, $rule, $options) {
    $conflicts = Users::count(array('email' => $value));
    if ($conflicts) {
        return false;
    }
    return true;
});
开发者ID:nilamdoc,项目名称:XGCWallet.org,代码行数:18,代码来源:Documents.php

示例4: user

 public function user($page = 1, $pagelength = 20)
 {
     if ($this->__init() == false) {
         $this->redirect('ex::dashboard');
     }
     $mongodb = Connections::get('default')->connection;
     $pagination = new Pagination($mongodb, '/Admin/user/{{PAGE}}/');
     if ($this->request->data) {
         $itemsPerPage = $this->request->data['pagelength'];
     } else {
         $itemsPerPage = $pagelength;
     }
     $currentPage = $page;
     $pagination->setQuery(array('#collection' => 'details', '#find' => array(), '#sort' => array('balance.BTC' => -1)), $currentPage, $itemsPerPage);
     $details = $pagination->Paginate();
     $Details = array();
     $i = 0;
     foreach ($details['dataset'] as $dt) {
         $user = Users::find('first', array('conditions' => array('username' => $dt['username'])));
         $mongodb = Connections::get('default')->connection;
         $YourOrders = Orders::connection()->connection->command(array('aggregate' => 'orders', 'pipeline' => array(array('$project' => array('_id' => 0, 'Action' => '$Action', 'user_id' => '$user_id', 'username' => '$username', 'Amount' => '$Amount', 'PerPrice' => '$PerPrice', 'Completed' => '$Completed', 'FirstCurrency' => '$FirstCurrency', 'SecondCurrency' => '$SecondCurrency', 'TotalAmount' => array('$multiply' => array('$Amount', '$PerPrice')))), array('$match' => array('Completed' => 'N', 'username' => $dt['username'])), array('$group' => array('_id' => array('Action' => '$Action', 'FirstCurrency' => '$FirstCurrency', 'SecondCurrency' => '$SecondCurrency'), 'Amount' => array('$sum' => '$Amount'), 'TotalAmount' => array('$sum' => '$TotalAmount'), 'No' => array('$sum' => 1))), array('$sort' => array('_id.Action' => 1)))));
         $trades = Trades::find('all', array('fields' => array('trade')));
         foreach ($YourOrders['result'] as $YO) {
             foreach ($trades as $trade) {
                 $FC = substr($trade['trade'], 0, 3);
                 $SC = substr($trade['trade'], 4, 3);
                 $CGroup = $FC . '-' . $SC;
                 if ($YO['_id']['Action'] == 'Buy' && $YO['_id']['FirstCurrency'] == $FC && $YO['_id']['SecondCurrency'] == $SC) {
                     $Details[$i]['Buy'][$CGroup]['Amount'] = $YO['Amount'];
                     $Details[$i]['Buy'][$CGroup]['TotalAmount'] = $YO['TotalAmount'];
                 }
                 if ($YO['_id']['Action'] == 'Sell' && $YO['_id']['FirstCurrency'] == $FC && $YO['_id']['SecondCurrency'] == $SC) {
                     $Details[$i]['Sell'][$CGroup]['Amount'] = $YO['Amount'];
                     $Details[$i]['Sell'][$CGroup]['TotalAmount'] = $YO['TotalAmount'];
                 }
             }
         }
         foreach ($trades as $trade) {
             $FC = substr($trade['trade'], 0, 3);
             $SC = substr($trade['trade'], 4, 3);
             $Details[$i][$FC] = $dt['balance'][$FC];
             $Details[$i][$SC] = $dt['balance'][$SC];
         }
         $Details[$i]['username'] = $user['username'];
         $Details[$i]['firstname'] = $user['firstname'];
         $Details[$i]['lastname'] = $user['lastname'];
         $Details[$i]['email'] = $user['email'];
         $Details[$i]['ip'] = $user['ip'];
         $Details[$i]['created'] = $user['created'];
         $i++;
     }
     $page_links = $pagination->getPageLinks();
     $title = "User";
     $TotalUsers = Users::count();
     $title = "Users";
     $keywords = "Admin, Users";
     $description = "Admin panel for users";
     return compact('title', 'users', 'page_links', 'TotalUsers', 'Details', 'title', 'keywords', 'description', 'pagelength');
 }
开发者ID:nilamdoc,项目名称:msx,代码行数:59,代码来源:AdminController.php

示例5: function

Validator::add('uniqueWalletID', function ($value, $rule, $options) {
    $conflicts = Users::count(array('walletid' => $value));
    if ($conflicts) {
        return false;
    }
    return true;
});
Validator::add('uniqueEmail', function ($value, $rule, $options) {
    $conflicts = Users::count(array('email' => $value));
    if ($conflicts) {
        return false;
    }
    return true;
});
Validator::add('uniqueUsername', function ($value, $rule, $options) {
    $conflicts = Users::count(array('username' => $value));
    if ($conflicts) {
        return false;
    }
    return true;
});
Users::applyFilter('save', function ($self, $params, $chain) {
    if ($params['data']) {
        $params['entity']->set($params['data']);
        $params['data'] = array();
    }
    if (!$params['entity']->exists()) {
        $params['entity']->created = new \MongoDate();
    }
    return $chain->next($self, $params, $chain);
});
开发者ID:nilamdoc,项目名称:msx,代码行数:31,代码来源:Users.php


注:本文中的app\models\Users::count方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。