simialbi / yii2-ticket
Ticketing system for yii2
Installs: 782
Dependents: 3
Suggesters: 0
Security: 0
Stars: 3
Watchers: 3
Forks: 4
Open Issues: 0
Type:yii2-extension
Requires
- php: >=5.6
- bower-asset/autosize: ^4.0.2
- bower-asset/resumablejs: ^1.1.0
- kartik-v/yii2-grid: ^3.3.0
- kartik-v/yii2-widget-select2: ^2.1.0
- rmrevin/yii2-fontawesome: ^3.4.0
- sandritsch91/yii2-widget-flatpickr: ^1.0.0
- simialbi/yii2-simialbi-base: >=0.10.1 <1.0 | ^1.0.0
- yiisoft/yii2: ^2.0.20
- yiisoft/yii2-bootstrap4: ^2.0.4
Requires (Dev)
- fortawesome/font-awesome: ^5.10.0
- phpunit/phpunit: <7
- simialbi/yii2-kanban: ^1.0.0
- simialbi/yii2-summernote: ^1.1.0
- yiisoft/yii2-coding-standards: ~2.0
Suggests
- simialbi/yii2-summernote: Install this extension to use rich text fields in comment fields
This package is auto-updated.
Last update: 2024-12-24 10:10:14 UTC
README
Resources
Installation
The preferred way to install this extension is through composer.
Either run
$ php composer.phar require --prefer-dist simialbi/yii2-ticket
or add
"simialbi/yii2-ticket": "^1.0.0"
to the require
section of your composer.json
.
Usage
In order to use this module, you will need to:
- Setup Module your application so that the module is available.
- Create a user identity class which extends UserInterface.
- Assign roles to users
Setup Module
Configure the module in the modules section of your Yii configuration file.
'modules' => [ 'ticket' => [ 'class' => 'simialbi\yii2\ticket\Module', //'richTextFields' => true, //'kanbanModule' => 'kanban', //'smsProvider' => 'smsProvider', //'canAssignTicketsToNonAgents' => false, //'on ticketCreated' => function ($event) {}, //[...] ] ]
Parameters
Events
Setup console config and apply migrations
Apply the migrations either with the following command: yii migrate --migration-namespaces='simialbi\yii2\ticket\migrations'
or configure your console like this:
[ 'controllerMap' => [ 'migrate' => [ 'class' => 'yii\console\controllers\MigrateController', 'migrationNamespaces' => [ 'simialbi\yii2\ticket\migrations' ] ] ] ]
and apply the yii migrate
command.
Be sure to have an authManager configured. The migration process creates the needed roles by this module.
Create identity
Create an identity class which implements simialbi\yii2\models\UserInterface
e.g.:
<?php use yii\db\ActiveRecord; use simialbi\yii2\models\UserInterface; class User extends ActiveRecord implements UserInterface { /** * {@inheritDoc} */ public static function tableName() { return 'user'; } /** * {@inheritDoc} */ public static function findIdentity($id) { return static::findOne($id); } /** * {@inheritDoc} */ public static function findIdentityByAccessToken($token, $type = null) { return static::findOne(['access_token' => $token]); } /** * {@inheritDoc} */ public function getId() { return $this->id; } /** * {@inheritDoc} */ public function getAuthKey() { return $this->auth_key; } /** * {@inheritDoc} */ public function validateAuthKey($authKey) { return $this->getAuthKey() === $authKey; } /** * {@inheritDoc} */ public function getImage() { return $this->image; } /** * {@inheritDoc} */ public function getName() { return trim($this->first_name . ' ' . $this->last_name); } /** * {@inheritDoc} */ public function getEmail() { return $this->email; } /** * {@inheritDoc} */ public function getMobile() { return $this->mobile; } /** * {@inheritDoc} */ public static function findIdentities() { return static::find()->all(); } }
After creating this class define it as identity class in your application configuration:
'components' => [ 'user' => [ 'identityClass' => 'app\models\User' ] ]
Assign roles to users
The migration process created the needed roles and permissions by this module. You should now have the following roles created:
Assign the roles to the corresponding users. Afterwards you can navigate to /ticket/topic
to administrate your ticket
topics (e.g. IT
). Each user with a role assigned can navigate to /ticket
to view either their own tickets
(ticketAuthor
), tickets of the topics they were assigned (ticketAgent
) or all tickets of all topics
(ticketAdministrator
).
License
yii2-ticket is released under MIT license. See bundled LICENSE for details.