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


PHP User::tableName方法代码示例

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


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

示例1: actionTopic

 public function actionTopic($username)
 {
     $this->title = $username . '提的建议 - ' . Yii::$app->name;
     $this->description = '';
     $this->canonical = Yii::$app->params['domain'] . 'member/' . $username . '/topic';
     $user = $this->findModel($username);
     $query = (new Query())->select('topic.*, node.enname, node.name, user.username, user.avatar')->from(Topic::tableName())->leftJoin(Node::tableName(), 'node.id = topic.node_id')->leftJoin(User::tableName(), 'user.id = topic.user_id')->where(['node.is_hidden' => 0])->andWhere(['topic.user_id' => $user->id]);
     $pagination = new Pagination(['defaultPageSize' => Yii::$app->params['pageSize'], 'totalCount' => $query->count()]);
     $model = $query->orderBy(['id' => SORT_DESC])->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('topic', ['model' => $model, 'user' => $user, 'pagination' => $pagination]);
 }
开发者ID:advance100,项目名称:yunjianyi,代码行数:11,代码来源:MemberController.php

示例2: actionUserMobileFilter

 public function actionUserMobileFilter($q = null, $id = null)
 {
     Yii::$app->response->format = Response::FORMAT_JSON;
     $output = ['results' => ['id' => '', 'text' => '']];
     if (!is_null($q)) {
         $sql = 'SELECT id, mobile AS text FROM ' . User::tableName() . ' WHERE mobile LIKE :like ORDER BY mobile ASC LIMIT 25';
         $output['results'] = Yii::$app->db->createCommand($sql, [':like' => "%{$q}%"])->queryAll();
     } elseif ($id > 0 && ($user = User::findOne($id))) {
         $output['results'] = ['id' => $id, 'text' => $user->mobile];
     }
     return $output;
 }
开发者ID:daixianceng,项目名称:xiaoego.com,代码行数:12,代码来源:OrderController.php

示例3: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = MediaModel::find()->from(['media' => $this->tableName()]);
     $query->innerJoinWith(['mediaAuthor' => function ($query) {
         /* @var $query \yii\db\ActiveQuery */
         return $query->from(['author' => User::tableName()]);
     }]);
     $query->leftJoin(['post' => Post::tableName()], 'media.media_post_id = post.id');
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     $dataProvider->setSort(['attributes' => ArrayHelper::merge($dataProvider->sort->attributes, ['username' => ['asc' => ['username' => SORT_ASC], 'desc' => ['username' => SORT_DESC], 'label' => 'Author', 'value' => 'username']]), 'defaultOrder' => ['id' => SORT_DESC]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     $query->andFilterWhere(['id' => $this->id, 'media_author' => $this->media_author, 'media_post_id' => $this->media_post_id, 'media_comment_count' => $this->media_comment_count]);
     $query->andFilterWhere(['like', 'media_title', $this->media_title])->andFilterWhere(['like', 'media_excerpt', $this->media_excerpt])->andFilterWhere(['like', 'media_content', $this->media_content])->andFilterWhere(['like', 'media_password', $this->media_password])->andFilterWhere(['like', 'media_slug', $this->media_slug])->andFilterWhere(['like', 'media_mime_type', $this->media_mime_type])->andFilterWhere(['like', 'media_comment_status', $this->media_comment_status])->andFilterWhere(['like', 'media_date', $this->media_date])->andFilterWhere(['like', 'media_modified', $this->media_modified])->andFilterWhere(['like', 'post.post_title', $this->post_title])->andFilterWhere(['like', 'author.username', $this->username]);
     return $dataProvider;
 }
开发者ID:fbarrento,项目名称:yii2-content,代码行数:27,代码来源:Media.php

示例4: search

 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Post::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query, 'sort' => ['defaultOrder' => ['id' => SORT_DESC]]]);
     $this->load($params);
     if (!$this->validate()) {
         // uncomment the following line if you do not want to return any records when validation fails
         // $query->where('0=1');
         return $dataProvider;
     }
     // grid filtering conditions
     $post = Post::tableName();
     $user = User::tableName();
     $query->andFilterWhere([$post . '.id' => $this->id, $post . '.status' => $this->status, 'create_time' => $this->create_time, 'update_time' => $this->update_time, 'author_id' => $this->author_id]);
     $query->andFilterWhere(['like', 'title', $this->title])->andFilterWhere(['like', 'content', $this->content])->andFilterWhere(['like', 'tags', $this->tags]);
     $query->join('INNER JOIN', $user, $post . '.author_id = User.id');
     $query->andFilterWhere(['like', $user . '.username', $this->username]);
     return $dataProvider;
 }
开发者ID:lanfp,项目名称:testgit2,代码行数:27,代码来源:PostSearch.php

示例5: actionView

 public function actionView($nodeName)
 {
     $node = $this->findModel($nodeName);
     if ($node->need_login == 1 && Yii::$app->user->isGuest) {
         Yii::$app->getSession()->setFlash('danger', '你访问的节点需要登陆之后才能查看');
         return $this->redirect('/account/login?next=/node/' . $nodeName);
     }
     if (!empty($node->bg) && $node->use_bg == 1) {
         $this->bg = $node->bg;
     }
     if (!empty($node->bg_color)) {
         $this->bg_color = $node->bg_color;
     }
     $this->title = $node->name . ' - ' . Yii::$app->name;
     $this->description = '';
     $this->canonical = Yii::$app->params['domain'] . 'node/' . $nodeName;
     $query = (new Query())->select('topic.*, node.enname, node.name, user.username, user.avatar')->from(Topic::tableName())->leftJoin(Node::tableName(), 'node.id = topic.node_id')->leftJoin(User::tableName(), 'user.id = topic.user_id')->where(['node.id' => $node->id]);
     $pagination = new Pagination(['defaultPageSize' => Yii::$app->params['pageSize'], 'totalCount' => $query->count()]);
     $model = $query->orderBy(['id' => SORT_DESC])->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('view', ['model' => $model, 'node' => $node, 'pagination' => $pagination]);
 }
开发者ID:advance100,项目名称:yunjianyi,代码行数:21,代码来源:NodeController.php

示例6: findActiveUser

 /**
  * 查找活跃用户
  * @param int $limit
  * @return array|\yii\db\ActiveRecord[]
  */
 public static function findActiveUser($limit = 12)
 {
     $cacheKey = md5(__METHOD__ . $limit);
     if (false === ($items = \Yii::$app->cache->get($cacheKey))) {
         $items = User::find()->joinWith(['merit', 'userInfo'])->where([User::tableName() . '.status' => 10])->orderBy(['merit' => SORT_DESC, '(like_count+thanks_count)' => SORT_DESC])->limit($limit)->all();
         //一天缓存
         \Yii::$app->cache->set($cacheKey, $items, 86400, new TagDependency(['tags' => [NamingHelper::getCommonTag(User::className())]]));
     }
     return $items;
 }
开发者ID:grutabow,项目名称:getyii,代码行数:15,代码来源:UserService.php

示例7: actionRecent

 public function actionRecent()
 {
     $this->title = '最近的主题 - ' . Yii::$app->name;
     $this->description = '';
     $pagination = new Pagination(['defaultPageSize' => Yii::$app->params['pageSize'], 'totalCount' => (new Query())->from(Topic::tableName() . ' topic')->leftJoin(Node::tableName() . ' node', 'node.id = topic.node_id')->where('node.is_hidden = 0')->count()]);
     $topic = (new Query())->select('topic.*, node.enname, node.name, user.username, user.avatar')->from(Topic::tableName() . ' topic')->leftJoin(Node::tableName() . ' node', 'node.id = topic.node_id')->leftJoin(User::tableName() . ' user', 'user.id = topic.user_id')->where('node.is_hidden = 0')->orderBy(['topic.id' => SORT_DESC])->offset($pagination->offset)->limit($pagination->limit)->all();
     return $this->render('recent', ['topic' => $topic, 'pagination' => $pagination]);
 }
开发者ID:npk,项目名称:v2sex,代码行数:8,代码来源:SiteController.php

示例8: HotTopic

 /**
  * 热门主题
  * @param int $num 获取几条热门主题
  * @return array|\yii\db\ActiveRecord[]
  */
 static function HotTopic($num = 8)
 {
     return $topic = (new Query())->select('topic.*, user.username, user.avatar')->from(Topic::tableName() . ' topic')->leftJoin(Node::tableName() . ' node', 'node.id = topic.node_id')->leftJoin(User::tableName() . ' user', 'user.id = topic.user_id')->where('node.is_hidden = 0')->andWhere(['between', 'topic.created', strtotime(date('Y-m-d H:i', time())) - 86400, strtotime(date('Y-m-d H:i', time()))])->orderBy(['topic.reply' => SORT_DESC])->limit($num)->all();
 }
开发者ID:boxcore,项目名称:v2sex,代码行数:9,代码来源:Topic.php

示例9:

<?php

return ['adminEmail' => 'admin@example.com', 'supportEmail' => 'support@example.com', 'user.passwordResetTokenExpire' => 3600, 'mdm.admin.configs' => ['userTable' => \common\models\User::tableName(), 'menuTable' => '{{%auth_menu}}'], 'ckeditorConfig' => ['language' => 'zh-cn', 'font_names' => '宋体;楷体;黑体;微软雅黑;隶书;仿宋;Arial;Comic Sans MS;Courier New;Tahoma;Times New Roman;Verdana']];
开发者ID:max-wen,项目名称:yii2-app-advanced-autoEnv,代码行数:3,代码来源:params.php

示例10: safeUp

 /**
  * @inheritdoc
  */
 public function safeUp()
 {
     $this->createTable($this->tableName, ['id' => $this->primaryKey(), 'model_name' => $this->string()->notNull(), 'model_id' => $this->integer()->notNull(), 'user_id' => $this->integer()->defaultValue(null) . ' COMMENT "User"', 'name' => $this->string()->defaultValue(null) . ' COMMENT "Name"', 'content' => $this->text()->notNull() . ' COMMENT "Content"', 'tree' => $this->integer()->defaultValue(null), 'lft' => $this->integer()->notNull(), 'rgt' => $this->integer()->notNull(), 'depth' => $this->integer()->notNull(), 'status_id' => $this->smallInteger(2)->notNull()->defaultValue(0) . ' COMMENT "Status"', 'published' => $this->boolean()->notNull()->defaultValue(1) . ' COMMENT "Published"', 'position' => $this->integer()->notNull()->defaultValue(0) . ' COMMENT "Position"', 'created_at' => $this->integer()->notNull() . ' COMMENT "Created at"', 'updated_at' => $this->integer()->notNull() . ' COMMENT "Updated at"'], $this->tableOptions);
     $this->addForeignKey('fk-comment-user_id-user-id', $this->tableName, 'user_id', \common\models\User::tableName(), 'id', 'SET NULL', 'CASCADE');
 }
开发者ID:tolik505,项目名称:bl,代码行数:8,代码来源:m160107_133314_create_comment_table.php

示例11: User

 /**
  * 获取我关注的人
  * @param bool $onlyId
  * @return array|\yii\db\ActiveRecord[]
  */
 static function User($onlyId = true)
 {
     if ($onlyId) {
         if (!($FollowUser = Yii::$app->cache->get('FollowUserId' . Yii::$app->user->id))) {
             $FollowUser = ArrayHelper::map(Follow::find()->select('follow_id')->where(['user_id' => Yii::$app->user->id, 'type' => 1])->asArray()->all(), 'follow_id', 'follow_id');
             Yii::$app->cache->set('FollowUserId' . Yii::$app->user->id, $FollowUser, 0);
         }
     } else {
         if (!($FollowUser = Yii::$app->cache->get('FollowUser' . Yii::$app->user->id))) {
             $FollowUser = (new Query())->from(User::tableName())->where(['in', 'id', Follow::User()])->all();
             Yii::$app->cache->set('FollowUser' . Yii::$app->user->id, $FollowUser, 0);
         }
     }
     return $FollowUser;
 }
开发者ID:advance100,项目名称:yunjianyi,代码行数:20,代码来源:Follow.php

示例12: actionView

 /**
  * Displays a single Topic model.
  * @param integer $id
  * @return mixed
  * @throws BadRequestHttpException
  * @throws NotFoundHttpException
  * @throws \Exception
  */
 public function actionView($id)
 {
     $model = $this->findModel($id);
     if ($model->need_login == 1 && Yii::$app->user->isGuest) {
         Yii::$app->getSession()->setFlash('danger', '你访问的建议需要登陆之后才能查看');
         return $this->redirect('/account/login?next=/topic/' . $id);
     }
     if (!empty($model->node->bg) && $model->node->use_bg == 1) {
         $this->bg = $model->node->bg;
     }
     if (!empty($model->node->bg_color)) {
         $this->bg_color = $model->node->bg_color;
     }
     $this->title = $model->title . ' - ' . Yii::$app->name;
     if (isset($model->content->content)) {
         $this->description = $model->node->name . ' - ' . $model->user->username . ' - ' . Helper::truncateUtf8String($model->content->content, 200);
     } else {
         $this->description = $model->node->name . ' - ' . $model->user->username . Helper::truncateUtf8String($model->title, 200);
     }
     $this->canonical = Yii::$app->params['domain'] . 'topic/' . $id;
     $replyQuery = (new Query())->select('reply.*, user.username, user.avatar, user.role')->from(Reply::tableName())->leftJoin(User::tableName(), 'user.id = reply.user_id')->where(['reply.topic_id' => $id]);
     $pagination = new Pagination(['defaultPageSize' => Yii::$app->params['ReplyPageSize'], 'totalCount' => $replyQuery->count()]);
     $replyList = $replyQuery->offset($pagination->offset)->limit($pagination->limit)->all();
     $reply = new Reply();
     if (!Yii::$app->user->isGuest) {
         $model->updateCounters(['click' => 1]);
         $reply = new Reply();
         if ($reply->load(Yii::$app->request->post()) && $reply->save()) {
             Yii::$app->cache->delete('ReplyCount');
             $this->redirect('/topic/' . $id . '#Reply');
         }
         return $this->render('view', ['model' => $model, 'reply' => $reply, 'replyList' => $replyList, 'pagination' => $pagination]);
     } else {
         return $this->render('view', ['model' => $model, 'reply' => $reply, 'replyList' => $replyList, 'pagination' => $pagination]);
     }
 }
开发者ID:advance100,项目名称:yunjianyi,代码行数:44,代码来源:TopicController.php

示例13: findActiveUser

 /**
  * 查找活跃用户
  * @param int $limit
  * @return array|\yii\db\ActiveRecord[]
  */
 public static function findActiveUser($limit = 12)
 {
     return User::find()->joinWith(['merit', 'userInfo'])->where([User::tableName() . '.status' => 10])->orderBy(['merit' => SORT_DESC, '(like_count+thanks_count)' => SORT_DESC])->limit($limit)->all();
 }
开发者ID:richardcj,项目名称:getyii,代码行数:9,代码来源:UserService.php

示例14: getREQPlanOfId

 /**
  * 根据原始ID获取最新的续约订单
  * @param $id
  */
 public static function getREQPlanOfId($id)
 {
     if (empty($id)) {
         return false;
     }
     $record_arr = (new Query())->from(PlanRecord::tableName() . ' as pr')->select(['pr.id', 'u.username', 'u.realname', 'pr.money_insure', 'pr.money_op', 'pr.money_warning', 'pr.money_force', 'pr.money_settlement', 'pr.status', 'pr.parent_id'])->leftJoin(User::tableName() . ' as u', 'pr.user_id = u.id')->where(['pr.parent_id' => $id, 'pr.parent_type' => PlanRecord::PARENT_TYPE_RENEW])->one();
     if (empty($record_arr)) {
         return false;
     }
     if ($record_arr['status'] == PlanRecord::STATUS_EXPIRED) {
         return self::getREQPlanOfId($record_arr['id']);
     }
     return $record_arr;
 }
开发者ID:johnny618,项目名称:love,代码行数:18,代码来源:PlanHelper.php

示例15: getUserEgreso

 public function getUserEgreso()
 {
     return $this->hasOne(\common\models\User::className(), ['id' => 'egr_id_user'])->from(\common\models\User::tableName() . ' uegr');
 }
开发者ID:ibergonzi,项目名称:country,代码行数:4,代码来源:Accesos.php


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