Skip to content

Commit a973517

Browse files
committed
initial commit
0 parents  commit a973517

File tree

238 files changed

+14089
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

238 files changed

+14089
-0
lines changed

.gitignore

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/vendor
2+
/.idea
3+
/.vscode

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2023 BINSHOPS
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in
13+
all copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21+
THE SOFTWARE.

README.md

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
# Laravel Ticket System
2+
A simple helpdesk ticketing system for Laravel 5.1+ (5.1 – 5.8 and 6.* - 7.* - 8.* - 9.* - 10.*) which integrates smoothly with Laravel default users and auth system.
3+
It will integrate into your current Laravel project within minutes, and you can offer your customers and your team a nice and simple support ticket system.
4+
5+
## Features:
6+
1. Three main users roles users, agents, and admins
7+
2. Users can create tickets, keep track of their tickets status, giving comments, and close their own tickets (access permissions are configurable)
8+
3. Auto assigning agents to tickets, the system searches for agents in specific department and auto select the agent with lowest queue
9+
4. Simple admin panel
10+
5. Localization (Arabic, Brazilian Portuguese, Deutsch (German), English, Farsi, French, Hungarian, Italian, Persian, Russian, and Spanish language packs are included)
11+
6. Very simple installation and integration process
12+
7. Admin dashboard with statistics and performance tracking graphs
13+
8. Simple text editor for tickets descriptions and comments allows images upload
14+
15+
## Quick Installation:
16+
17+
### Requirements
18+
**First Make sure you have got this Laravel setup working:**
19+
20+
1. [Laravel](http://laravel.com/docs#installation)
21+
2. [Users table](http://laravel.com/docs/authentication)
22+
3. [Laravel email configuration](http://laravel.com/docs/mail#sending-mail)
23+
4. Bootstrap 3, or Bootstrap 4
24+
5. Jquery
25+
26+
**Dependents that are getting installed and configured automatically by LaravelTicket (no action required from you)**
27+
28+
1. [LaravelCollective HTML](https://github.com/laravelcollective/html)
29+
2. [Laravel Datatables](https://github.com/yajra/laravel-datatables)
30+
3. [HTML Purifier](https://github.com/mewebstudio/Purifier)
31+
32+
33+
### Installation steps (4-8 minutes)
34+
35+
36+
Step 1. Run this code via your terminal (1-2 minutes)
37+
```shell
38+
composer require 'binshops/laravel-ticket:0.*'
39+
```
40+
41+
Step 2. After install, you have to add this line on your `config/app.php` in Service Providers section (1-2 minutes).
42+
```php
43+
Binshops\LaravelTicket\LaravelTicketServiceProvider::class;
44+
```
45+
46+
Step 3. Check if App\User exists
47+
48+
Step 4. Make sure you have [authentication](https://laravel.com/docs/10.x/authentication) set up. In 5.2+, you can use `php artisan make:auth`
49+
50+
Step 5. [Setting up your master view for LaravelTicket integration (1-2 minutes)](https://github.com/binshops/laravel-ticket/wiki/Integrating-LaravelTicket-views-with-your-project-template)
51+
52+
Step 6. Register at least one user into the system and log it in.
53+
54+
Step 7. Go ahead to http://your-project-url/tickets-install to finalize the installation (1-2 minutes)
55+
56+
Default laravel-ticket front route: http://your-project-url/tickets
57+
58+
Default laravel-ticket admin route: http://your-project-url/tickets-admin
59+
60+
**Notes:**
61+
62+
Make sure you have created at least one status, one priority, and one category before you start creating tickets.
63+
64+
If you move your installation folder to another path (or server), you need to update the row with slug='routes' in table `laravelticketsettings`. After that, don't forget to flush the entire cache.
65+
66+
## Documentation
67+
[LaravelTicket Wiki](https://github.com/binshops/laravel-ticket/wiki)
68+
69+
## Migration
70+
- `laravelcollective/html` This package is abandoned and no longer maintained. The author suggests using the spatie/laravel-html package instead.

composer.json

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
{
2+
"name": "binshops/laravel-ticket",
3+
"description": "A simple ticketing system for Laravel 5.1 – 5.8 and 6.* - 7.* - 8.* - 9.* - 19.* -which integrates smoothly with Laravel default users and auth system",
4+
"type": "laravel-package",
5+
"keywords": ["laravel","helpdesk", "ticket", "support", "crm", "customer support"],
6+
"require": {
7+
"laravel/framework": "^5.1|^6.0|^7.0|^8.0|^9.0|^10.0",
8+
"laravelcollective/html": "^5.1|^6.0",
9+
"illuminate/support": "^5.1|^6.0|^7.0|^8.0|^9.0|^10.0",
10+
"yajra/laravel-datatables-oracle": "^6.0|^8.0|^9.4|^9.11|^10.4",
11+
"jenssegers/date": "^3.0|^4.0",
12+
"mews/purifier": "^2.0|^3.1|^3.4",
13+
"doctrine/dbal": "^2.5|^2.6|^2.10|^3.6"
14+
},
15+
"license": "MIT",
16+
"authors": [
17+
{
18+
"name": "Sam Berry",
19+
"homepage": "https://github.com/binshops/laravel-ticket",
20+
"email": "[email protected]"
21+
}
22+
],
23+
"autoload": {
24+
"psr-4": {
25+
"Binshops\\LaravelTicket\\": "src"
26+
}
27+
}
28+
}

src/Console/Htmlify.php

+57
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
<?php
2+
3+
namespace Binshops\LaravelTicket\Console;
4+
5+
use Illuminate\Console\Command;
6+
use Binshops\LaravelTicket\Models\Comment;
7+
use Binshops\LaravelTicket\Models\Ticket;
8+
9+
class Htmlify extends Command
10+
{
11+
/**
12+
* The name and signature of the console command.
13+
*
14+
* @var string
15+
*/
16+
protected $signature = 'laravelticket:htmlify';
17+
18+
/**
19+
* The console command description.
20+
*
21+
* @var string
22+
*/
23+
protected $description = 'Copies column `content` to column `html` in comments and tickets tables while escaping and replacing new lines with <br> tags. Run this when upgrading from <=v0.2.2';
24+
25+
public function __construct()
26+
{
27+
parent::__construct();
28+
}
29+
30+
/**
31+
* Execute the console command.
32+
*
33+
* @return mixed
34+
*/
35+
public function handle()
36+
{
37+
$tickets = Ticket::all();
38+
39+
foreach ($tickets as $ticket) {
40+
if (!$ticket->html) {
41+
$ticket->html = nl2br(e($ticket->content));
42+
$ticket->content = e($ticket->content);
43+
$ticket->save();
44+
}
45+
}
46+
47+
$comments = Comment::all();
48+
49+
foreach ($comments as $comment) {
50+
if (!$comment->html) {
51+
$comment->html = nl2br(e($comment->content));
52+
$comment->content = e($comment->content);
53+
$comment->save();
54+
}
55+
}
56+
}
57+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
<?php
2+
3+
namespace Binshops\LaravelTicket\Controllers;
4+
5+
use App\Http\Controllers\Controller;
6+
use Illuminate\Http\Request;
7+
use Illuminate\Support\Facades\Session;
8+
use Binshops\LaravelTicket\Models\Agent;
9+
use Binshops\LaravelTicket\Models\Setting;
10+
11+
class AdministratorsController extends Controller
12+
{
13+
public function index()
14+
{
15+
$administrators = Agent::admins();
16+
17+
return view('laravelticket::admin.administrator.index', compact('administrators'));
18+
}
19+
20+
public function create()
21+
{
22+
$users = Agent::paginate(Setting::grab('paginate_items'));
23+
24+
return view('laravelticket::admin.administrator.create', compact('users'));
25+
}
26+
27+
public function store(Request $request)
28+
{
29+
$administrators_list = $this->addAdministrators($request->input('administrators'));
30+
$administrators_names = implode(',', $administrators_list);
31+
32+
Session::flash('status', trans('laravelticket::lang.administrators-are-added-to-administrators', ['names' => $administrators_names]));
33+
34+
return redirect()->action('\Binshops\LaravelTicket\Controllers\AdministratorsController@index');
35+
}
36+
37+
public function update($id, Request $request)
38+
{
39+
$this->syncAdministratorCategories($id, $request);
40+
41+
Session::flash('status', trans('laravelticket::lang.administrators-joined-categories-ok'));
42+
43+
return redirect()->action('\Binshops\LaravelTicket\Controllers\AdministratorsController@index');
44+
}
45+
46+
public function destroy($id)
47+
{
48+
$administrator = $this->removeAdministrator($id);
49+
50+
Session::flash('status', trans('laravelticket::lang.administrators-is-removed-from-team', ['name' => $administrator->name]));
51+
52+
return redirect()->action('\Binshops\LaravelTicket\Controllers\AdministratorsController@index');
53+
}
54+
55+
/**
56+
* Assign users as administrators.
57+
*
58+
* @param $user_ids
59+
*
60+
* @return array
61+
*/
62+
public function addAdministrators($user_ids)
63+
{
64+
$users = Agent::find($user_ids);
65+
foreach ($users as $user) {
66+
$user->laravelticket_admin = true;
67+
$user->save();
68+
$users_list[] = $user->name;
69+
}
70+
71+
return $users_list;
72+
}
73+
74+
/**
75+
* Remove user from the administrators.
76+
*
77+
* @param $id
78+
*
79+
* @return mixed
80+
*/
81+
public function removeAdministrator($id)
82+
{
83+
$administrator = Agent::find($id);
84+
$administrator->laravelticket_admin = false;
85+
$administrator->save();
86+
87+
// Remove him from tickets categories as well
88+
if (version_compare(app()->version(), '5.2.0', '>=')) {
89+
$administrator_cats = $administrator->categories->pluck('id')->toArray();
90+
} else { // if Laravel 5.1
91+
$administrator_cats = $administrator->categories->lists('id')->toArray();
92+
}
93+
94+
$administrator->categories()->detach($administrator_cats);
95+
96+
return $administrator;
97+
}
98+
99+
/**
100+
* Sync Administrator categories with the selected categories got from update form.
101+
*
102+
* @param $id
103+
* @param Request $request
104+
*/
105+
public function syncAdministratorCategories($id, Request $request)
106+
{
107+
$form_cats = ($request->input('administrator_cats') == null) ? [] : $request->input('administrator_cats');
108+
$administrator = Agent::find($id);
109+
$administrator->categories()->sync($form_cats);
110+
}
111+
}

0 commit comments

Comments
 (0)