# sync-basalam/1.9.0/includes/Actions/Controller/TicketActions/CreateTicket.php

ووسلام – همگام سازی ووکامرس و باسلام, version 1.9.0. 36 lines.

- Page: https://pluginprobe.com/plugins/sync-basalam/1.9.0/code/includes/Actions/Controller/TicketActions/CreateTicket.php
- Raw: https://pluginprobe.com/plugins/sync-basalam/1.9.0/raw/includes/Actions/Controller/TicketActions/CreateTicket.php
- Modified: 2026-06-21T07:48:14+00:00

Line numbers below start at 1. Link to a line or a range by appending a fragment to the
page URL, for example `https://pluginprobe.com/plugins/sync-basalam/1.9.0/code/includes/Actions/Controller/TicketActions/CreateTicket.php#L10-L20`.

```php
<?php

namespace SyncBasalam\Actions\Controller\TicketActions;

use SyncBasalam\Actions\Controller\ActionController;
use SyncBasalam\Services\TicketServiceManager;
use SyncBasalam\Utilities\TicketExtraInfoFormatter;

defined('ABSPATH') || exit;

class CreateTicket extends ActionController
{
    public function __invoke()
    {
        $ticketManager = new TicketServiceManager();

        $title   = isset($_POST['title'])   ? \sanitize_text_field(\wp_unslash($_POST['title']))   : null;
        $subject = isset($_POST['subject']) ? \sanitize_text_field(\wp_unslash($_POST['subject'])) : null;
        $content = isset($_POST['content']) ? \sanitize_textarea_field(\wp_unslash($_POST['content'])) : '';
        $content = TicketExtraInfoFormatter::appendFromRequest($content, $_POST);

        $fileIds = isset($_POST['file_ids']) && is_array($_POST['file_ids'])
            ? array_map('intval', $_POST['file_ids'])
            : [];

        $result = $ticketManager->createTicket($title, $subject, $content, $fileIds);
        if (isset($result['body'])) $ticket = json_decode($result['body'], true);
        else {
            wp_die('خطایی در ارسال تیکت رخ داده است. لطفا مجددا تلاش کنید.');
        }

        wp_redirect(admin_url("admin.php?page=sync_basalam_ticket&ticket_id=" . $ticket['data']['id']));
        exit();
    }
}

```
