Yii v2 snippet guide

Comparing #115 with #116

Revision #116 was created by rackycz rackycz on Sep 27, 2019, 8:18:40 AM.

edit

Content

[...]
**Simple access rights**
---
Every controller can allow different users/guests to use different actions. Method behaviors() can be used to do this. If you generate the controller using GII the method will be present and you will just add the "access-part" like this:

```php

 
// don't forget to add this import:
 
use yii\filters\AccessControl;
 
 
public function behaviors() {
return [
// ...
'access' => [
'class' => AccessControl::className(),
'rules' => [
[...]