pantera-digital/yii2-helpdesk

此软件包最新版本(dev-master)没有可用的许可证信息。

Yii2 helpdesk模块

安装: 89

依赖: 0

建议者: 0

安全性: 0

星级: 5

关注者: 6

分支: 2

公开问题: 2

类型:yii2-extension

dev-master 2024-04-12 07:41 UTC

This package is auto-updated.

Last update: 2024-09-12 08:46:05 UTC


README

注意:此模块依赖于pantera-digital/yii2-media

安装

运行

php composer require pantera-digital/yii2-helpdesk "*"

或者添加到composer.json

"pantera-digital/yii2-helpdesk": "*",

并执行

php composer update

配置您的应用

 [
    'bootstrap' => [... ,'media'],
    'modules' => [
        ...
        'media' => [
            'class' => pantera\media\Module::className(),
            'permissions' => ['admin'], //permissions for administrate media module
            'mediaUrlAlias' => 'path for url access to media files',
            'mediaFileAlias' => 'path for storage media files',
            'tableName' => 'pantera_media', //table name for media 
        ],
        'helpdesk' => [
            'class' => \pantera\helpdesk\Module::class, 
            'profileModel' => function() { //here u can catch the current user profile model
                if(!Yii::$app->user->isGuest) {
                    return Yii::$app->user->identity->profile; 
                } else {
                    return null;
                }
            },
            'nameAttribute' => 'HERE NAME ATTRIBUTE OF USER PROFILE MODEL',
            'emailAttribute' => 'HERE EMAIL ATTRIBUTE OF USER MODEL',
            'googleCaptchaSiteKey' => 'here your google recaptcha site key',
            'googleCaptchaSecret' => 'here your google recaptcha secret',
            'mailNotificationView' => 'here you can set the path to your mail view like @app/mail/view_name',
            'userClass' => 'this is a class for your user module by default it dependency on \dektrium\user\models\User';
        ],  
    ],
    ...
];

配置您的管理员应用

 'helpdesk' => [
            'class' => \pantera\helpdesk\Module::class,
            'viewPath' => '@vendor/pantera-digital/yii2-helpdesk/admin/views',
            'controllerNamespace' => 'pantera\helpdesk\admin\controllers'
 ],

添加到控制台配置

 ...
 'controllerMap' => [
        'migrate' => [
            'class' => MigrateController::className(),
            'migrationPath' => [
                ....
                '@vendor/pantera-digital/yii2-helpdesk/migrations',
                '@pantera/media/migrations',
                ....
            ],
        ],
 ... 

或运行迁移

php yii migrate --migrationPath=vendor/pantera-digital/yii2-media/migrations
php yii migrate --migrationPath=vendor/pantera-digital/yii2-helpdesk/migrations

可用操作

管理员
helpdesk/default/index
helpdesk/default/view
用户
helpdesk/default/index
helpdesk/default/view
无认证用户
helpdesk/defaul/index

注意:仅在yii2高级应用上进行了测试