1. Go to this page and download the library: Download bhhaskin/laravel-tickets 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/ */
bhhaskin / laravel-tickets example snippets
use Bhhaskin\Tickets\Models\Ticket;
$ticket = Ticket::create([
'user_id' => $user->id,
'subject' => 'DNS outage',
'body' => "We cannot reach example.com from the LA office.",
'priority' => Ticket::PRIORITY_HIGH,
]);
// Attach arbitrary models
$ticket->attachModel($site);
// Optional: assign a workspace if available
if (class_exists(\Bhhaskin\LaravelWorkspaces\Support\WorkspaceConfig::class)) {
$ticket->assignWorkspace($workspace);
}
// Replies render markdown automatically
$ticket->replies()->create([
'user_id' => $user->id,
'body' => "Here is **more** context",
]);
// Tickets for a specific user
$mine = Ticket::forUser($user)->latest()->get();
// Tickets for a workspace (works when laravel-workspaces is installed)
$workspaceTickets = Ticket::forWorkspace($workspace)->with(['owner','replies','associations.ticketable'])->paginate();