| 1 |
<?php |
| 2 |
|
| 3 |
namespace SyncBasalam\Actions\Controller\CategoryActions; |
| 4 |
|
| 5 |
use SyncBasalam\Admin\Product\Category\CategoryMapping; |
| 6 |
use SyncBasalam\Actions\Controller\ActionController; |
| 7 |
|
| 8 |
defined('ABSPATH') || exit; |
| 9 |
|
| 10 |
class GetMappingStats extends ActionController |
| 11 |
{ |
| 12 |
public function __invoke() |
| 13 |
{ |
| 14 |
if (!current_user_can('manage_options')) { |
| 15 |
wp_die('Unauthorized'); |
| 16 |
} |
| 17 |
|
| 18 |
try { |
| 19 |
$stats = CategoryMapping::getMappingStats(); |
| 20 |
wp_send_json_success($stats); |
| 21 |
} catch (\Exception $e) { |
| 22 |
wp_send_json_error($e->getMessage()); |
| 23 |
} |
| 24 |
} |
| 25 |
} |
| 26 |
|