Replace free-text brand_tone/brand_voice_notes with a single structured brand_voice_traits JSON column backed by the BrandVoiceTrait enum, exposed as choice-chip pills in the brand settings UI and autofillable from a site. Brand voice and visuals become per-automation toggles on the Generate node. Unify the image controls into one 0-10 picker (0 = text-only, 1 = single, 2+ = carousel) and feed the generator the most restrictive selected network so copy fits every platform. Pass that same platform context through the humanizer pass — extracted into a shared ResolvesPlatformCopyBudget trait — so the rewrite can no longer drift past the character cap the generator respected, in both the automation and manual creation flows. Persist the trigger node's schedule editor fields on save (they were silently dropped by validated() for lacking validation rules).
52 lines
1.2 KiB
PHP
52 lines
1.2 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\Account;
|
|
use App\Models\User;
|
|
use App\Models\Workspace;
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends Factory<Workspace>
|
|
*/
|
|
class WorkspaceFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
return [
|
|
'user_id' => User::factory(),
|
|
'name' => fake()->company(),
|
|
'content_language' => 'en',
|
|
'brand_voice_traits' => ['balanced', 'direct'],
|
|
'brand_font' => 'Inter',
|
|
'image_style' => 'cinematic',
|
|
];
|
|
}
|
|
|
|
public function configure(): static
|
|
{
|
|
return $this->afterMaking(function (Workspace $workspace) {
|
|
if (! $workspace->account_id) {
|
|
if ($workspace->user_id) {
|
|
$user = User::find($workspace->user_id);
|
|
|
|
if ($user?->account_id) {
|
|
$workspace->account_id = $user->account_id;
|
|
|
|
return;
|
|
}
|
|
}
|
|
|
|
$workspace->account_id = Account::factory()->create()->id;
|
|
}
|
|
});
|
|
}
|
|
}
|