Files
ledstar_laravel/app/Library/VK/Service/VkPostImportService.php
T
amikhaylov e90314f18b Added VKBot
2026-05-28 02:16:26 +03:00

48 lines
1.1 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Library\VK\Service;
use App\Library\VK\Mapper\PostMapper;
use App\Library\VK\Resources\WallResource;
use Illuminate\Support\Facades\Log;
class VkPostImportService
{
public function __construct(
private WallResource $resource,
private PostMapper $mapper
) {
}
public function run(): void
{
//$result = $this->resource->get('ledstarband', 1, 100);
if (empty ($result['items']) ) {
Log::info('Post import failed: no items found');
}
# echo "\nFound items: ".$result['count']."\n";
// foreach ($result['items'] as $item) {
// $post = $this->mapper->map($item);
// if(! $post->isEmpty()) {
// # print_r($post->toArray());
// }
// }
$res = $this->resource->getById('-93243530_2113');
foreach ($res as $item) {
$post = $this->mapper->map($item);
if(! $post->isEmpty()) {
print_r($post->toArray());
}
}
# print_r($res);
}
}