database migrations for help desk tickets, and queues
models for help desk tickets and queues model for EveMail modified app config for queues added new routes for jump bridges composer updated for autoloader modified JumpBridgeController added new controllers for HelpDesk and HelpDeskAdmin
This commit is contained in:
@@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class HelpDeskAdminController extends Controller
|
||||
{
|
||||
//
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use App\Http\Controllers\Controller;
|
||||
|
||||
class HelpDeskController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display form to submit a new ticket
|
||||
*/
|
||||
public function displayNewTicket() {
|
||||
|
||||
}
|
||||
|
||||
public function storeTicket() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display current open tickets for the user
|
||||
*/
|
||||
public function displayMyTickets() {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Modify currently open ticket for the user
|
||||
*/
|
||||
public function editTicket(Request $request) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,45 @@ namespace App\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
use App\Library\Finances\JumpBridgeTax;
|
||||
|
||||
class JumpBridgeController extends Controller
|
||||
{
|
||||
//
|
||||
/**
|
||||
* Displays all statistics on one page
|
||||
*/
|
||||
public function displayAll() {
|
||||
//Create a helper class variable
|
||||
$jbHelper30 = new JumpBridgeTax(30);
|
||||
$jbHelper60 = new JumpBridgeTax(60);
|
||||
$jbHelper90 = new JumpBridgeTax(90);
|
||||
|
||||
return view('jumpbridges.all');
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays overall jump bridge usage based corporation data
|
||||
*/
|
||||
public function displayCorpUsage() {
|
||||
return view('jumpbridges.corp.select');
|
||||
}
|
||||
|
||||
public function ajaxCorpUsage() {
|
||||
//Get the statistics for overall usage by corps and send back to webpage via ajax
|
||||
|
||||
return response()->json(array('data' => $data), 200);
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays jump bridge usage based on structure
|
||||
*/
|
||||
public function displayStructureUsage() {
|
||||
return view('jumpbridges.structure.select');
|
||||
}
|
||||
|
||||
public function ajaxStructureUsage() {
|
||||
//Get the statistics for overall usage by structure and send back to the webpage via ajax
|
||||
|
||||
return response()->json(array('data' => $data), 200);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,73 @@
|
||||
<?php
|
||||
|
||||
namespace App\Jobs;
|
||||
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
|
||||
use App\Library\Esi\Mail;
|
||||
|
||||
use App\Models\EveMail as EveMailModel;
|
||||
|
||||
class SendEveMail implements ShouldQueue
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
/**
|
||||
* Class Variable for eve mail
|
||||
*/
|
||||
protected $eveMail;
|
||||
|
||||
/**
|
||||
* Create a new job instance.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(EveMailModel $mail) {
|
||||
$this->eveMail = $mail;
|
||||
}
|
||||
|
||||
/**
|
||||
* Execute the job.
|
||||
* Utilized by using SendEveMail::dispatch($mail);
|
||||
* The model is passed into the dispatch function, then added to the queue
|
||||
* for processing.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function handle()
|
||||
{
|
||||
//Access the model in the queue for processing
|
||||
$mail = $this->eveMail;
|
||||
|
||||
//Create a new Mail class variable
|
||||
$esi = new Mail();
|
||||
|
||||
//Process the mail from the model to send a new mail
|
||||
$esi->SendGeneralMail($mail->recepient, $mail->subject, $mail->body);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the time the job should timeout
|
||||
*
|
||||
* @return \DateTime
|
||||
*/
|
||||
public function retryUntil() {
|
||||
return now()->addSeconds(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* The job failed to process.
|
||||
*
|
||||
* @param Exception $exception
|
||||
* @return void
|
||||
*/
|
||||
public function failed(Exception $exception)
|
||||
{
|
||||
// Send user notification of failure, etc...
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,33 @@ use Seat\Eseye\Exceptions\RequestFailedException;
|
||||
|
||||
class Mail {
|
||||
|
||||
public function SendGeneralMail($recipient, $subject, $body) {
|
||||
//Retrieve the token for main character to send mails from
|
||||
$token = EsiToken::where(['character_id' => 93738489])->get();
|
||||
//Create the ESI authentication container
|
||||
$config = config('esi');
|
||||
$authentication = new EsiAuthentication([
|
||||
'client_id' => $config['client_id'],
|
||||
'secret' => $config['secret'],
|
||||
'refresh_token' => $token[0]->refresh_token,
|
||||
]);
|
||||
$esi = new Eseye($authentication);
|
||||
try {
|
||||
$esi->setBody([
|
||||
'body' => $body,
|
||||
'receipients' => [
|
||||
'recipient_id'=> $recipient,
|
||||
'recipient_type' => 'character',
|
||||
],
|
||||
'subject' => $subject,
|
||||
])->invoke('post', '/characters/{character_id}/mail/', [
|
||||
'character_id' => 93738489,
|
||||
]);
|
||||
} catch(RequestFailedException $e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public function SendMail($charId, $taxAmount, $subject, $body) {
|
||||
//Retrieve the token for Amund Risalo
|
||||
$token = DB::table('EsiTokens')->where('character_id', 93738489)->get();
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
<?php
|
||||
|
||||
namespace App\Models;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class EveMail extends Model
|
||||
{
|
||||
//Table Name
|
||||
protected $table = 'eve_mails';
|
||||
|
||||
//Timestamps
|
||||
public $timestamps = 'true';
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HelpDeskTicket extends Model
|
||||
{
|
||||
//Table Name
|
||||
protected $table = 'help_desk_tickets';
|
||||
|
||||
//Primary Key
|
||||
public $primaryKey = 'id';
|
||||
|
||||
//Timestamps
|
||||
public $timestamps = true;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'ticket_id',
|
||||
'user_id',
|
||||
'assigned_id',
|
||||
'department',
|
||||
'subject',
|
||||
'body',
|
||||
];
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
namespace App;
|
||||
|
||||
use Illuminate\Database\Eloquent\Model;
|
||||
|
||||
class HelpDeskTicketResponse extends Model
|
||||
{
|
||||
//Table Name
|
||||
protected $table = 'help_desk_ticket_responses';
|
||||
|
||||
//Primary Key
|
||||
public $primaryKey = 'id';
|
||||
|
||||
//Timestamps
|
||||
public $timestamps = true;
|
||||
|
||||
/**
|
||||
* The attributes that are mass assignable
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $fillable = [
|
||||
'ticket_id',
|
||||
'assigned_id',
|
||||
'body',
|
||||
];
|
||||
}
|
||||
Reference in New Issue
Block a user