This commit is contained in:
f4ilji
2024-10-14 14:56:10 +05:00
parent 77b3e3b4b1
commit dd3a0c6ecd
258 changed files with 6548 additions and 1777 deletions
+48
View File
@@ -0,0 +1,48 @@
<?php
namespace App\Http\Controllers;
use App\Services\VK\VkService;
use Illuminate\Http\Request;
use VK\Client\VKApiClient;
use VK\OAuth\Scopes\VKOAuthUserScope;
use VK\OAuth\VKOAuth;
use VK\OAuth\VKOAuthDisplay;
use VK\OAuth\VKOAuthResponseType;
class VkPostController extends Controller
{
private string $wall_token;
private VkService $vkService;
public function __construct()
{
$this->vkService = new VkService(new VKApiClient());
$this->wall_token = env('WALL_ACCESS_VK_TOKEN');
}
public function index()
{
$oauth = new VKOAuth();
$client_id = 52468445;
$redirect_uri = 'https://crawdad-fresh-bream.ngrok-free.app/';
$display = VKOAuthDisplay::PAGE;
$scope = array(VKOAuthUserScope::WALL, VKOAuthUserScope::PHOTOS);
$state = 'dJZ3N05uZc9jpcEgxD6y';
$groups_ids = array(227826614);
$browser_url = $oauth->getAuthorizeUrl(VKOAuthResponseType::TOKEN, $client_id, $redirect_uri, $display, $scope, $state, $groups_ids);
return redirect($browser_url);
}
public function wall()
{
return $this->vkService->createAlbum('Тестовый альбом');
}
}