<?php

namespace Mtc\Plugins\Clinic\Http\Controllers\Admin;

use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Mtc\Shop\Item;

/**
 * Class ProductController
 */
class ProductController extends ClinicController
{
    /**
     * Search products
     *
     * @param Request $request
     * @return JsonResponse
     */
    public function search(Request $request): JsonResponse
    {
        return response()
            ->json([
                'items' => Item::searchItems($_POST['query'])
                    ->toArray(),
                'success' => '1',
            ]);
    }
}
