Revision #128 has been created by rackycz on Oct 4, 2019, 11:58:37 AM with the memo:
contact
« previous (#127) next (#129) »
Changes
Title
unchanged
Yii v2 snippet guide
Category
unchanged
Tutorials
Yii version
unchanged
2.0
Tags
unchanged
tutorial,beginner,yii2
Content
changed
[...]
- In Site controller replace ContactForm with Contact (in section "use" and in actionContact) and in the action change the IF condition:
```php
use app\models\Contact;
// ...
public function actionContact() {
$model = new Contact();
if ($model->load(Yii::$app->request->post()) && $model->save()) {
// ...
```
- Open the new contact model and add one attribute, 2 rules[...]
['verifyCode', 'captcha'],
['email', 'email'],
// and translation for Captcha
'verifyCode' => Yii::t('app', 'Verification'),
```
- You can also delete one paragraph from view/site/contact
```
HTMLphp
<p>
Note that if you turn on the Yii debugger ...
```
**Tests - unit + opa**[...]