2026-01-15 01:13:44 +00:00
|
|
|
<?php
|
|
|
|
|
|
refactor: settings redesign, Spanish translations, language system, strict_types
Settings pages:
- Redesign layout to match Sendkit (max-w-4xl, space-y-12, Separator sections)
- Merge Members page into Workspace settings with Table, invite Dialog, ConfirmDeleteModal
- Add workspace logo upload/delete routes and controller methods
- Translate all hardcoded strings in Workspace.vue modals
Language system:
- Drop languages table, replace language_id FK with locale string column on users
- Create config/languages.php for available languages and default locale
- Add Spanish (es) translations (13 files)
- Simplify HandleInertiaRequests, ProfileController, RegisteredUserController
Code quality:
- Add declare(strict_types=1) to all PHP files
- Fix MastodonPublisher using wrong attribute (filename -> original_filename)
- Fix HasMediaTest for new has_photo/photo_url accessors
- Fix PublishToSocialPlatformTest type error revealed by strict_types
- Remove orphaned Language model from AppServiceProvider morph map
- Update User TypeScript interface (has_photo, photo_url, locale)
- Eager load media relation on workspaces to prevent N+1
- Add 8 new tests for workspace logo upload/delete
- Update workspace settings test to assert members/invitations props
All 710 tests passing.
2026-03-30 03:20:43 +00:00
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
2026-01-15 01:13:44 +00:00
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
2026-01-17 17:44:37 +00:00
|
|
|
use App\Enums\SocialAccount\Platform;
|
|
|
|
|
use App\Enums\SocialAccount\Status;
|
2026-03-29 22:24:28 +00:00
|
|
|
use App\Models\SocialAccount;
|
2026-01-17 17:44:37 +00:00
|
|
|
use App\Models\Workspace;
|
2026-01-15 01:13:44 +00:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
|
|
/**
|
2026-03-29 22:24:28 +00:00
|
|
|
* @extends Factory<SocialAccount>
|
2026-01-15 01:13:44 +00:00
|
|
|
*/
|
|
|
|
|
class SocialAccountFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
|
|
|
|
* Define the model's default state.
|
|
|
|
|
*
|
|
|
|
|
* @return array<string, mixed>
|
|
|
|
|
*/
|
|
|
|
|
public function definition(): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
2026-01-17 17:44:37 +00:00
|
|
|
'workspace_id' => Workspace::factory(),
|
|
|
|
|
'platform' => Platform::LinkedIn,
|
|
|
|
|
'platform_user_id' => $this->faker->uuid(),
|
|
|
|
|
'username' => $this->faker->userName(),
|
|
|
|
|
'display_name' => $this->faker->name(),
|
|
|
|
|
'access_token' => $this->faker->sha256(),
|
|
|
|
|
'refresh_token' => $this->faker->sha256(),
|
|
|
|
|
'token_expires_at' => now()->addDays(60),
|
|
|
|
|
'scopes' => [],
|
|
|
|
|
'meta' => [],
|
|
|
|
|
'status' => Status::Connected,
|
2026-01-15 01:13:44 +00:00
|
|
|
];
|
|
|
|
|
}
|
2026-01-17 17:44:37 +00:00
|
|
|
|
|
|
|
|
public function linkedin(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::LinkedIn,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::LinkedIn->requiredPublishScopes(),
|
2026-01-17 17:44:37 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function linkedinPage(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::LinkedInPage,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::LinkedInPage->requiredPublishScopes(),
|
2026-01-17 17:44:37 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function x(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::X,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::X->requiredPublishScopes(),
|
2026-01-17 17:44:37 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function tiktok(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::TikTok,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::TikTok->requiredPublishScopes(),
|
2026-01-17 17:44:37 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function youtube(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::YouTube,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::YouTube->requiredPublishScopes(),
|
2026-01-17 17:44:37 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function facebook(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::Facebook,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::Facebook->requiredPublishScopes(),
|
2026-01-17 17:44:37 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function instagram(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::Instagram,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::Instagram->requiredPublishScopes(),
|
2026-01-17 17:44:37 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function threads(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::Threads,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::Threads->requiredPublishScopes(),
|
2026-01-17 17:44:37 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-18 18:56:51 +00:00
|
|
|
public function pinterest(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::Pinterest,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::Pinterest->requiredPublishScopes(),
|
2026-01-18 18:56:51 +00:00
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function bluesky(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::Bluesky,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::Bluesky->requiredPublishScopes(),
|
2026-01-18 18:56:51 +00:00
|
|
|
'token_expires_at' => now()->addHours(2),
|
|
|
|
|
'meta' => [
|
|
|
|
|
'service' => 'https://bsky.social',
|
|
|
|
|
'identifier' => 'test@example.com',
|
|
|
|
|
'password' => encrypt('test-app-password'),
|
|
|
|
|
],
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function mastodon(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'platform' => Platform::Mastodon,
|
2026-04-01 14:25:25 +00:00
|
|
|
'scopes' => Platform::Mastodon->requiredPublishScopes(),
|
2026-01-18 18:56:51 +00:00
|
|
|
'token_expires_at' => null, // Mastodon tokens don't expire
|
|
|
|
|
'meta' => [
|
|
|
|
|
'instance' => 'https://mastodon.social',
|
|
|
|
|
'client_id' => 'test-client-id',
|
|
|
|
|
'client_secret' => 'test-client-secret',
|
|
|
|
|
],
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
2026-01-17 17:44:37 +00:00
|
|
|
public function disconnected(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'status' => Status::Disconnected,
|
|
|
|
|
'error_message' => 'Token expired',
|
|
|
|
|
'disconnected_at' => now(),
|
|
|
|
|
]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public function tokenExpired(): static
|
|
|
|
|
{
|
|
|
|
|
return $this->state(fn (array $attributes) => [
|
|
|
|
|
'status' => Status::TokenExpired,
|
|
|
|
|
'token_expires_at' => now()->subDay(),
|
|
|
|
|
]);
|
|
|
|
|
}
|
2026-01-15 01:13:44 +00:00
|
|
|
}
|