Difference between #48 and #49 of
Yii v2 snippet guide

Revision #49 has been created by rackycz on Sep 20, 2019, 12:56:09 PM with the memo:

edit
« previous (#48) next (#50) »

Changes

Title unchanged

Yii v2 for beginners

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2

Content changed

[...]
INSERT INTO `user` (`id`, `username`, `password`, `email`, `authKey`) VALUES (NULL, 'user01', '0497fe4d674fe37194a6fcb08913e596ef6a307f', 'user01@gmail.com', NULL);
```

If you must use MyISAM instead of InnoDB, just change the word InnoDB into MYISAM.

Then use GII to generate model
 + CRUD. The GII URL will probably be - [http://localhost/basic/web/index.php?r=gii](http://localhost/basic/web/index.php?r=gii). - When creating the model, check this checkbox: **Enable I18N** ... we will need i18n later - Enter table name "user" and model name "User"  
- Do not create CRUD now, first use the snippet below


- Note that there already is a model named User in the demo app. You will not need it if you want to use login-via-DB so feel free to check the overwrite-checkbox in GII. The newly created User model will now be usable only for table operations, not for login. But we will enhance it, see te snippet below.
[...]
```

Now you can also create CRUD = Create Read Update Delete = views and controller.
 
 
- Model Class = app\models\User
 
- Search Model Class = app\models\UserSearch
 
- Controller Class = app\controllers\UserController
 
- View Path can be empty or you can set: views\user
 
- Again enable i18n
 
 
Now you can edit usert on this URL: [http://localhost/basic/web/index.php?r=user](http://localhost/basic/web/index.php?r=user)
 
 
i18n translations + Session
---
... text ...

Access rights
---
[...]
7 0
4 followers
Viewed: 274 923 times
Version: 2.0
Category: Tutorials
Written by: rackycz
Last updated by: rackycz
Created on: Sep 19, 2019
Last updated: a year ago
Update Article

Revisions

View all history