$ent = $update->entities[0];
{"offset":0,"length":4,"type":"text_link","url":"https:\/\/t.me\/"}
$url = $ent.url;
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
'urlManager' => [
'class' => 'codemix\localeurls\UrlManager',
'languages' => ['uz', 'ru', 'en', 'kuz'],
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<slug:[\w\-]+>' => 'pages/index',
],
],
'urlManager' => [
'class' => 'codemix\localeurls\UrlManager',
'languages' => ['uz', 'ru', 'en', 'kuz'],
'enablePrettyUrl' => true,
'showScriptName' => false,
'rules' => [
'<slug:[\w\-]+>' => 'pages/index',
],
],
В статье по ссылке уже решение, подставьте только свои данные.
Или Вы тоже не понимаете как это сделать?
public function actionSignup()
{
$model = new SignupForm();
if ($model->load(Yii::$app->request->post())) {
if(UploadedFile::getInstance($model, 'avatar') != null)
{
$model->avatar= UploadedFile::getInstance($model, 'img');
$imageName = $model->avatar->basename.time();
$imageName =md5(md5($imageName));
if (file_exists($imageName.$model->avatar->extension)) {
unlink("uploads/avatars/".$imageName.$model->avatar->extension);
}
$model->avatar->saveAs('uploads/avatars/'.$imageName.'.'.$model->avatar->extension);
$model->avatar='uploads/avatars/'.$imageName.'.'.$model->avatar->extension;
}
else
{
$model->avatar='uploads/no_photo.png';
}
if ($user = $model->signup()) {
if (Yii::$app->getUser()->login($user)) {
return $this->goHome();
}
}
}
return $this->render('signup', [
'model' => $model,
]);
}
class SignupForm extends Model
{
public $username;
public $email;
public $password;
public $first_name;
public $second_name;
public $avatar;
/**
* {@inheritdoc}
*/
public function rules()
{
return [
['username', 'trim'],
['username', 'required'],
['username', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This username has already been taken.'],
['username', 'string', 'min' => 2, 'max' => 255],
['first_name', 'string', 'min' => 2, 'max' => 255],
['second_name', 'string', 'min' => 2, 'max' => 255],
['avatar', 'string', 'min' => 2, 'max' => 255],
['email', 'trim'],
['email', 'required'],
['email', 'email'],
['email', 'string', 'max' => 255],
['email', 'unique', 'targetClass' => '\common\models\User', 'message' => 'This email address has already been taken.'],
['password', 'required'],
['password', 'string', 'min' => 6],
];
}
/**
* Signs user up.
*
* @return User|null the saved model or null if saving fails
*/
public function signup()
{
if (!$this->validate()) {
return null;
}
$user = new User();
$user->username = $this->username;
$user->first_name = $this->first_name;
$user->second_name = $this->second_name;
$user->email = $this->email;
$user->avatar = $this->avatar;
$user->setPassword($this->password);
$user->generateAuthKey();
return $user->save() ? $user : null;
}
}