PHP code example of escalated-dev / escalated-laravel
1. Go to this page and download the library: Download escalated-dev/escalated-laravel 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/ */
escalated-dev / escalated-laravel example snippets
use Escalated\Laravel\Contracts\HasTickets;
use Escalated\Laravel\Contracts\Ticketable;
class User extends Authenticatable implements Ticketable
{
use HasTickets;
}
use Escalated\Laravel\Concerns\PresentsAsTicketSubject;
use Escalated\Laravel\Contracts\TicketSubject;
class Project extends Model implements TicketSubject
{
use PresentsAsTicketSubject;
public function ticketSubjectSubtitle(): ?string
{
return 'Project · '.$this->customer->name;
}
public function ticketSubjectUrl(): ?string
{
return route('projects.show', $this);
}
public function ticketSubjectColor(): ?string
{
return '#2563eb';
}
public function ticketSubjectIcon(): ?string
{
return 'folder';
}
}
// app/Console/Kernel.php or routes/console.php
Schedule::command('escalated:check-sla')->everyMinute();
Schedule::command('escalated:evaluate-escalations')->everyFiveMinutes();
Schedule::command('escalated:close-resolved')->daily();
Schedule::command('escalated:purge-activities')->weekly();
Schedule::command('escalated:poll-imap')->everyMinute(); // Only if using IMAP adapter
// This automatically dispatches to PHP plugins AND SDK plugins:
escalated_do_action('ticket.created', $ticket->toArray());
// Same for filters:
$channels = escalated_apply_filters('notification.channels', []);
// config/escalated.php
'plugins' => [
'enabled' => true,
'sdk_enabled' => true, // Enable the Node.js bridge
'runtime_command' => 'node node_modules/@escalated-dev/plugin-runtime/dist/index.js',
'runtime_cwd' => base_path(), // Working directory for the subprocess
],
js
page.props.escalated = {
prefix: 'support', // Route prefix from config
is_agent: true, // Current user can access agent views
is_admin: false, // Current user can access admin views
}