1. Go to this page and download the library: Download ligoo/zammad-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/ */
ligoo / zammad-laravel example snippets
// routes/web.php
Route::get('/contact', [ContactController::class, 'contact'])->name('contact.form');
// In your controller
use Ligoo\ZammadLaravel\Http\Controllers\ContactController as ZammadController;
public function contact()
{
return Inertia::render('Contact', [
'contactConfig' => ZammadController::getFormConfig(),
]);
}
use Ligoo\ZammadLaravel\Http\Controllers\ContactController;
// Your Inertia page
Route::get('/contact', function () {
return Inertia::render('Contact', [
'contactConfig' => ContactController::getFormConfig(),
]);
})->name('contact.form');
// The package's POST route is still registered automatically at /contact
use Ligoo\ZammadLaravel\Http\Controllers\ContactController;
Route::get('/contact', [ContactController::class, 'create'])->name('contact.form');
Route::post('/contact', [ContactController::class, 'store'])
->middleware('zammad.throttle')
->name('contact.submit');
use Ligoo\ZammadLaravel\Facades\Zammad;
// Check if enabled
Zammad::isEnabled();
// Create a ticket programmatically
Zammad::createTicket([
'email' => '[email protected]',
'name' => 'John Doe',
'subject' => 'Help needed',
'message' => '<p>I need assistance...</p>',
]);
// Add a note to a ticket
Zammad::addTicketNote($ticketId, '<p>Internal note</p>', internal: true);
use Ligoo\ZammadLaravel\Facades\Captcha;
// Get current driver
$driver = Captcha::driver();
// Verify a token
$result = Captcha::driver()->verify($token, $ip);
if ($result->passed()) {
// Valid
}