protected function dataTables(){

        $allModels =  (new Query())->select(
            '('.(new Query())->select('count(*)')->from(Auctions::tableName())->createCommand()->rawSql.') as auctions,'.
            '('.(new Query())->select('count(*)')->from(Dealers::tableName())->createCommand()->rawSql.') as dealers,'.
            '('.(new Query())->select('count(*)')->from(Companies::tableName())->createCommand()->rawSql.') as companies,'.
            '('.(new Query())->select('count(*)')->from(Brands::tableName())->createCommand()->rawSql.') as brands,'.
            '('.(new Query())->select('count(*)')->from(Categories::tableName())->createCommand()->rawSql.') as categories'
        )->one();

        $_message = Auction::loggerMessageFormat('Admin Dashboard Created With :: ',$allModels);
        Auction::info($_message);

        return new ArrayDataProvider([
            'allModels' => $allModels,
            'pagination' => false
        ]);

    }
示例#2
0
    public function getCompanyDetails(){

        return (new Query())->select(
            '('.(new Query())->select('count(*)')->from(Auctions::tableName())->where(['company' => $this->id])->createCommand()->rawSql.') as companyAuctions,'.
            '('.(new Query())->select('count(*)')->from(CompanyUsers::tableName())->where('company=:c and user!=:u',[':c' => $this->id , ':u' => Auction::$app->user->id])->createCommand()->rawSql.') as companyUsers,'.
            '('.(new Query())->select('count(*)')->from(DealerCompany::tableName())->where(['company' => $this->id])->createCommand()->rawSql.') as companyDealers'
        )->one();

    }