本文整理汇总了PHP中app\models\Profile::getHost方法的典型用法代码示例。如果您正苦于以下问题:PHP Profile::getHost方法的具体用法?PHP Profile::getHost怎么用?PHP Profile::getHost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类app\models\Profile
的用法示例。
在下文中一共展示了Profile::getHost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createShop
private function createShop($login, $buyer_bonus, $recommender_bonus)
{
$user = new User();
$user->email = $login . '@mail.com';
$user->setPassword($user->email);
$user->generateAuthKey();
$user->save(false);
$profile = new Profile();
$profile->user_id = $user->id;
$profile->url = 'https://temp-mail.ru';
$profile->buyer_bonus = $buyer_bonus;
$profile->recommender_bonus = $recommender_bonus;
$profile->status_id = 1;
$profile->host = $profile->getHost($profile->url);
$profile->save(false);
$this->auth->assign($this->auth->createRole(User::ROLE_SHOP), $user->id);
return $user;
}
示例2: addUrl
public function addUrl($link)
{
$shop_id = null;
$text = '';
$profile = new Profile();
$host = $profile->getHost($link);
/* @var $shop Profile */
$shop = Profile::find()->where(['host' => $host])->one();
if ($shop) {
$shop_id = $shop->user_id;
$text .= 'магазин ' . $shop->url . '<br>';
$text .= 'бонус покупателю ' . $shop->buyer_bonus . '<br>';
$text .= 'бонус рекомендателю ' . $shop->recommender_bonus . '<br>';
$text .= 'статус ' . $shop->status->name . '<br>';
} elseif (!ModerateShop::find()->where(['url' => $host])->exists()) {
$moderateShop = new ModerateShop(['user_id' => Yii::$app->user->identity->id, 'url' => $host]);
$moderateShop->save();
}
$text .= 'Вы можете давать эту ссылку своим друзьям<br>';
$url = new Url(['user_id' => Yii::$app->user->identity->id, 'link' => $link, 'shop_id' => $shop_id]);
$url->save();
return $text . \yii\helpers\Url::to(['purchase/create', 'affiliate_id' => Yii::$app->user->identity->id, 'url_id' => $url->id], true);
}