frontend\modules\user\models\UserMeta::isUserAction PHP Method

isUserAction() public method

判断指定分类下操作是否存在
public isUserAction ( integer $type, string $do = '', integer $targetId ) : integer | string
$type integer 话题还是评论
$do string 动作
$targetId integer 话题ID或者评论ID
return integer | string
    public function isUserAction($type = 0, $do = '', $targetId)
    {
        return $this->find()->where(['target_id' => $targetId, 'user_id' => Yii::$app->user->id, 'target_type' => $type, 'type' => $do])->count();
    }

Usage Example

Exemplo n.º 1
0
 public function getThanks()
 {
     $model = new UserMeta();
     return $model->isUserAction(self::TYPE, 'thanks', $this->id);
 }
All Usage Examples Of frontend\modules\user\models\UserMeta::isUserAction