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 ]); }
/** * Action to Perform User Logout * Will go Home If User is already logout */ public function actionIndex() { if(Auction::$app->user->isGuest){ Auction::warning('User Already is Logged Out'); return $this->goHome(); } Auction::$app->user->logout(); //Setting Logger @info $message = Auction::loggerMessageFormat('User logout SuccessFully' ,[ 'class' => __CLASS__ , 'function' => __METHOD__, 'username' => Auction::$app->session->get('user.name'), 'role' => Auction::$app->session->get('user.role'), 'userId' => Auction::$app->user->id ]); Auction::info($message,Auction::LOGGER_FRONTEND_CATEGORY); return $this->goHome(); }
public function afterSave(){ $_model = new AuctionEmails(); $_model->message = strtr(MessageTemplate::MessageTemplate(DatabaseHelper::DEALER_REGISTRATION_TEMPLATE),['{name}' => $this->name]); $_model->to = $this->email; $_model->subject = 'Auction :: Company Registration'; $_model->from = 'Auction'; $_model->status = DatabaseHelper::SEND_MAIL; if($_model->save()){ Auction::info('Company Registration Email registered'); } else { $message= Auction::loggerMessageFormat('Email is not send to user due to following errors',$_model->getErrors()); Auction::error($message); } }
/** Send Reset Token */ public static function SendResetToken($event){ $message = ''; switch ($event->sender->mode){ case DatabaseHelper::TOKEN_SEND_MODE_WEB: $message = MessageTemplate::MessageTemplate(DatabaseHelper::FORGOT_PASSWORD_MAIL_TEMPLATE); $_model = new AuctionEmails(); $_model->to = $event->sender->userObject->email; $_model->subject = 'Auction :: Reset Password Email'; $_model->status = 0 ; $_model->from = 'Auction'; break; case DatabaseHelper::TOKEN_SEND_MODE_MOBILE: $message = MessageTemplate::MessageTemplate(DatabaseHelper::FORGOT_PASSWORD_SMS_TEMPLATE); $_model = new OptHistory(); $_model->mobile = $event->sender->userObject->mobile; break; } if($message == ''){ Auction::error('No Valid Msg Template Found For ' .$event->sender->mode.' in database'); throw new HttpException(400 , 'No Template Found'); } $_model->message = $message; if($_model->save()){ Auction::info('User Token successfully Created'); }else { $_message = Auction::loggerMessageFormat('User reset token template invalid ',$_model->getErrors()); Auction::error($_message); } }