PHP code example of empire2 / gaze-ticketsystem
1. Go to this page and download the library: Download empire2/gaze-ticketsystem 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/ */
empire2 / gaze-ticketsystem example snippets
$this->call([
\Empire2\GazeTicketsystem\Database\Seeders\TicketStatusSeeder::class,
\Empire2\GazeTicketsystem\Database\Seeders\TicketTypeSeeder::class,
]);
use Empire2\GazeTicketsystem\Concerns\IsTicketAdmin;
class User extends Authenticatable
{
use IsTicketAdmin;
public function scopeAdmins($query)
{
return $query->whereHas('roles', fn ($q) => $q->whereIn('name', ['admin', 'super-admin']));
}
}
'admin_resolver' => fn () => \App\Models\User::query()
->whereHas('roles', fn ($q) => $q->whereIn('name', ['admin', 'super-admin']))
->get(),
use Empire2\GazeTicketsystem\Contracts\TicketSourceResolver;
use Empire2\GazeTicketsystem\Sources\TicketSourceData;
class CrmInquirySourceResolver implements TicketSourceResolver
{
public function resolve(string $sourceType, mixed $sourceId): ?TicketSourceData
{
if ($sourceType !== 'crm_inquiry') {
return null;
}
$inquiry = \App\Models\CrmInquiry::find($sourceId);
return $inquiry ? new TicketSourceData(
title: "Anfrage: {$inquiry->subject}",
contactName: $inquiry->contact_name,
contactEmail: $inquiry->contact_email,
sourceContext: $inquiry->message,
url: route('crm.inquiries.show', $inquiry),
) : null;
}
}
'source_resolvers' => [
'support_draft' => \Empire2\GazeTicketsystem\Sources\GhostwriterSourceResolver::class,
'crm_inquiry' => \App\Tickets\CrmInquirySourceResolver::class,
],
use Empire2\GazeTicketsystem\Models\Ticket;
use Empire2\GazeTicketsystem\Enums\Priority;
$ticket = Ticket::create([
'title' => 'Login flow broken',
'body' => 'User reports a 500 on /login since 9:30',
'contact_name' => 'Max Mustermann',
'contact_email' => '[email protected] ',
'created_by' => $authUser->id,
'status_id' => $defaultStatus->id,
'type_id' => $supportType->id,
'priority' => Priority::HIGH,
]);
bash
composer vendor:publish --tag=gaze-ticketsystem-config
php artisan vendor:publish --tag=gaze-ticketsystem-migrations
php artisan migrate
bash
php artisan vendor:publish --tag=gaze-ticketsystem-views
php artisan vendor:publish --tag=gaze-ticketsystem-seeders
bash
php artisan gaze-ticketsystem:check-follow-ups
# alias:
php artisan ticket:check-follow-ups