| 1 |
<?php |
| 2 |
|
| 3 |
namespace FluentCart\Api\Invokable; |
| 4 |
|
| 5 |
use FluentCart\App\Services\Async\ImageAttachService; |
| 6 |
use FluentCart\Framework\Support\Arr; |
| 7 |
|
| 8 |
class ImageAttach |
| 9 |
{ |
| 10 |
public function __invoke($app, $params) |
| 11 |
{ |
| 12 |
$method = Arr::get($params, 'method'); |
| 13 |
$data = Arr::get($params, 'data'); |
| 14 |
$images = Arr::get($params, 'images'); |
| 15 |
|
| 16 |
if ($method === 'attachImageToVariant') { |
| 17 |
ImageAttachService::attachImageToVariant($data, $images); |
| 18 |
} else if ($method === 'attachImageToProduct') { |
| 19 |
ImageAttachService::attachImageToProduct($data, $images); |
| 20 |
} |
| 21 |
} |
| 22 |
} |