PHP code example of karnoweb / laravel-ticket-chat

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

    

karnoweb / laravel-ticket-chat example snippets




namespace App\Models;

use Illuminate\Foundation\Auth\User as Authenticatable;
use Karnoweb\TicketChat\Traits\HasTickets;
use Karnoweb\TicketChat\Traits\HasConversations;
use Karnoweb\TicketChat\Traits\CanBeDepartmentAgent;

class User extends Authenticatable
{
    use HasTickets, HasConversations, CanBeDepartmentAgent;
}

use Karnoweb\TicketChat\Facades\Ticket;

$ticket = Ticket::create([
    'title' => 'Need help',
    'description' => 'Description here',
    'created_by' => auth()->id(),
    'department_id' => 1,
    'priority' => 'high',
    'branch_id' => 1,  // optional (v2 multi-branch)
]);

Ticket::reply($ticket, auth()->id(), 'Your message here');

use Karnoweb\TicketChat\Facades\Chat;

$conversation = Chat::directTo(auth()->id(), $otherUserId, 'Hello!');

Chat::sendMessage($conversation, auth()->id(), 'Message text');
bash
php artisan ticket-chat:install
bash
php artisan vendor:publish --tag=ticket-chat-config
php artisan vendor:publish --tag=ticket-chat-migrations
php artisan migrate