PHP code example of wiensa / support-ticket

1. Go to this page and download the library: Download wiensa/support-ticket 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/ */

    

wiensa / support-ticket example snippets


// Destek talepleri için route'ları roup(function () {
    Route::prefix('support')->name('support.')->group(function () {
        

// Admin için destek talepleri route'larını roup(function () {
    Route::prefix('admin/support')->name('admin.support.')->group(function () {
        

// config/supportticket.php
'admin_middleware' => ['web', 'auth', 'admin'], // Admin middleware

use Wiensa\SupportTicket\Services\TicketService;
use Wiensa\SupportTicket\Services\AttachmentService;
use Wiensa\SupportTicket\Services\NotificationService;

// Ticket Service
$ticketService = app(TicketService::class);
$ticket = $ticketService->createTicket([
    'subject' => 'Konu',
    'message' => 'Mesaj',
    'priority' => 'medium',
    'category' => $categoryId,
], $user);

// Attachment Service
$attachmentService = app(AttachmentService::class);
$attachment = $attachmentService->uploadFile($file, $ticket, $user);

// Notification Service
$notificationService = app(NotificationService::class);
$notificationService->sendNewTicketNotifications($ticket);

// Yeni talep oluşturma
$response = $client->post('/api/support/tickets', [
    'json' => [
        'subject' => 'API Test',
        'message' => 'Bu bir API test talebidir',
        'category' => $categoryId,
        'priority' => 'high',
    ],
    'headers' => [
        'Authorization' => 'Bearer ' . $token,
    ],
]);
bash
php artisan supportticket:install
bash
php artisan migrate
bash
php artisan db:seed --class=Database\\Seeders\\SupportTicketCategorySeeder
php artisan db:seed --class=Database\\Seeders\\SupportTicketSettingsSeeder
bash
php artisan vendor:publish --tag=supportticket-views
bash
php artisan vendor:publish --tag=supportticket-config
bash
php artisan vendor:publish --tag=supportticket-lang
bash
php artisan vendor:publish --tag=supportticket-assets