PHP code example of linkrobins / support

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

    

linkrobins / support example snippets


use Flarum\Extend;
use LinkRobins\Support\Event\TicketStatusChanged;

return [
    (new Extend\Event())->listen(TicketStatusChanged::class, function (TicketStatusChanged $event) {
        // $event->ticket, $event->oldStatus, $event->newStatus, $event->actor
    }),
];

namespace Vendor\Example\TicketType;

use Flarum\User\User;
use LinkRobins\Support\RateLimiter;
use LinkRobins\Support\SupportCategory;
use LinkRobins\Support\SupportTicket;
use LinkRobins\Support\TicketType\AbstractTicketType;

class VerificationTicketType extends AbstractTicketType
{
    public const ID = 'verification';

    public function id(): string
    {
        return self::ID;
    }

    public function name(): string
    {
        return 'Identity Verification';
    }

    public function isAppeal(): bool
    {
        return false;
    }

    public function canCreate(User $actor, SupportCategory $category): bool
    {
        // Custom eligibility check (e.g. void
    {
        // Server-side validation or custom attribute mutation before saving
        if (empty($data['attributes']['verificationCode'])) {
            throw new \Tobyz\JsonApiServer\Exception\BadRequestException('Verification code is 

use LinkRobins\Support\Extend\TicketType;
use Vendor\Example\TicketType\VerificationTicketType;

return [
    (new TicketType())
        ->add(VerificationTicketType::ID, VerificationTicketType::class),
];
bash
composer igrate
php flarum cache:clear