How do i get a checkbox value inside signup model? I mean when it is not a checkboxlist, but a single check box... Only via $_POST array, or are there other methods?
instead of $_POST['SignupForm']['permissions']; we can have this one: $permission_lists = $this->permissions; since we already loaded the permission lists in the controller using the load() function .
Hi thank you very much realy i appriciate your effort really thanks a lot! just one question please how can i appair just the authitemchild because i think it is better imagine you have million object and every object have 4 permessions it is will be complexed .For example we can make 3 kind of user : sample user , admin, member and each one have it s authitems and will be appear just the authchild etc...
I tried the checkboxList in other form but the checklist is not in a list format, I mean, they appear together one next to the other one. What I need to do for having them in a list format? Thanks in advance :)
i'm not sure but you should use createRole(), createPermission() methods with add() method, when update you should revoke previous permission and assign a new one as offical docs says ????
use this function in your SiteController public function actionSignup() { $model = new SignupForm(); $authItems=AuthItem::find()->all(); if ($model->load(Yii::$app->request->post())) { if ($user = $model->signup()) { if (Yii::$app->getUser()->login($user)) { return $this->goHome(); } } } return $this->render('signup', [ 'model' => $model, 'authItems'=>$authItems, ]); } after that ... include this code in your signup.php
Good lesson. Its also good to see you make mistakes and see who you debug them.
Super lesson.
Hi, How this will be handled in update? I am not able to load the inserted selection. can you please help me on this.
How do i get a checkbox value inside signup model? I mean when it is not a checkboxlist, but a single check box... Only via $_POST array, or are there other methods?
Great job dude
thanks for great tutorial
instead of
$_POST['SignupForm']['permissions'];
we can have this one:
$permission_lists = $this->permissions;
since we already loaded the permission lists in the controller using the load() function .
I guess it's better to access post variable using yii::$app->request->post() instead of accessing $_POST directly.
Hi thank you very much realy i appriciate your effort really thanks a lot! just one question please how can i appair just the authitemchild because i think it is better imagine you have million object and every object have 4 permessions it is will be complexed .For example we can make 3 kind of user : sample user , admin, member and each one have it s authitems and will be appear just the authchild etc...
I love u man you are the best
I tried the checkboxList in other form but the checklist is not in a list format, I mean, they appear together one next to the other one. What I need to do for having them in a list format? Thanks in advance :)
i'm not sure but you should use createRole(), createPermission() methods with add() method, when update you should revoke previous permission and assign a new one as offical docs says ????
You should use the transactions :D
how to do this to a form that's generated from gii generator?
it has different structure from the sign up form, can't work if i just do the same
for update operation the selected checkboxes r not showing selected
Undefined variable: authItems
i had try a view time but i always get that error message. can you give me any solution? thanks
use this function in your SiteController
public function actionSignup()
{
$model = new SignupForm();
$authItems=AuthItem::find()->all();
if ($model->load(Yii::$app->request->post())) {
if ($user = $model->signup()) {
if (Yii::$app->getUser()->login($user)) {
return $this->goHome();
}
}
}
return $this->render('signup', [
'model' => $model,
'authItems'=>$authItems,
]);
}
after that ...
include this code in your signup.php
Hello, Can you create lesson for i18n?, thanks)
Please use singular form of words when naming tables in DB, not plural. Users(incorrect)->User(correct).
Customers->Customer
Posts->Post
Also, can you cut off those parts of video when you're getting errors and can't find out what to do.
I guess that the best thing would be if he leaves the part of the errors but tells you when he manage to resolved them.