Difference between #130 and #131 of
Yii v2 snippet guide

Revision #131 has been created by rackycz on Oct 4, 2019, 12:11:08 PM with the memo:

contact
« previous (#130) next (#132) »

Changes

Title unchanged

Yii v2 snippet guide

Category unchanged

Tutorials

Yii version unchanged

2.0

Tags unchanged

tutorial,beginner,yii2

Content changed

[...]
```php
<p>
Note that if you turn on the Yii debugger ...
```

Then some security - filtering users in the new ContactController:
 
 
```php
 
public function beforeAction($action) {
 
 
  if (!parent::beforeAction($action)) {
 
    return false;
 
  }
 
 
  $guestAllowedActions = [];
 
 
  if (Yii::$app->user->isGuest) {
 
    if (!in_array($action->actionMethod, $guestAllowedActions)) {
 
      return $this->redirect(['site/index']);
 
    }
 
  }
 
  
 
  return true;
 
}
 
```
 
 
**Tests - unit + opa** --- ... text ...
7 0
4 followers
Viewed: 274 827 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