PHP code example of luyadev / luya-module-frontendgroup

1. Go to this page and download the library: Download luyadev/luya-module-frontendgroup library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

luyadev / luya-module-frontendgroup example snippets


'modules' => [
    // ...
    'frontendgroup' => [
        'class' => 'luya\frontendgroup\Module',
        'frontendUsers' => [
            'user1', 'user2', 'user3',
        ],
        'frontendGroups' => [
            'groupA', 'groupB',
        ],
    ],
],

'bootstrap' => [
    // ...
    'frontendgroup',
],

'components' => [

    // ...

    'user1' => [
        'class' => 'luya\web\GroupUser',
        'identityClass' => 'app\models\User1Class',
    ],
    'user2' => [
        'class' => 'luya\web\GroupUser',
        'identityClass' => 'app\models\User2Class',
    ],
    'user3' => [
        'class' => 'luya\web\GroupUser',
        'identityClass' => 'app\models\User3Class',
    ],
]

// GroupUserIdentityInterface implentation

class User1 extends \yii\db\ActiveRecord implements GroupUserIdentityInterface
{
    // ...
    
    public function authGroups()
    {
        return ['groupA', 'groupB'];
    }
    
    // ...
}