trypost/app/Http/Resources/App/SocialAccountResource.php
Paulo Castellano dec2bc028a fix(linkedin): show connected company page on the accounts and onboarding grids
The unified LinkedIn card grouped connected accounts by looking the platform up in the rendered card list, but linkedin-page is no longer a card — so an org-only connection fell through to its own network key and the card showed 'Connect' for an already-connected page, with no way to disconnect or reconnect. Expose each account's network on SocialAccountResource and group by account.network instead.

Onboarding still built its connect grid from SocialPlatform::enabled() instead of isConnectable(), so it rendered a standalone LinkedIn Page card with a missing logo whose connect button hit the deleted connect/linkedin-page route (404). Filter by isConnectable() to match the accounts page.
2026-06-24 21:23:27 -03:00

33 lines
956 B
PHP

<?php
declare(strict_types=1);
namespace App\Http\Resources\App;
use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;
class SocialAccountResource extends JsonResource
{
/**
* @return array<string, mixed>
*/
public function toArray(Request $request): array
{
return [
'id' => $this->id,
'platform' => $this->platform,
'network' => $this->platform->network(),
'platform_user_id' => $this->platform_user_id,
'username' => $this->username,
'display_name' => $this->display_name,
'avatar_url' => $this->avatar_url,
'profile_url' => $this->profile_url,
'status' => $this->status,
'is_active' => $this->is_active,
'error_message' => $this->error_message,
'last_used_at' => $this->last_used_at,
'created_at' => $this->created_at,
];
}
}