trypost/database/factories/WorkspaceLabelFactory.php
Paulo Castellano 8689e54e55 refactor: restructure to Actions, subdomain routes (app/api), API tokens
- Extract business logic from controllers into Action classes:
  Post/, Workspace/, Hashtag/, Label/, Invite/, ApiKey/
- Create subdomain routing: app.trypost.test (Inertia dashboard),
  api.trypost.test (REST API with token auth)
- Add ApiToken model with tp_ prefix, token_lookup/hash auth
- Add AuthenticateApiToken middleware for API authentication
- Create Api controllers with JSON Resources for all entities
- Create App controllers that use Actions + Inertia responses
- Organize Form Requests into Api/ and App/ directories
- Add api_tokens migration
- Update all route names with app. prefix
- Update all tests to use new route names (684 passing)
2026-03-29 19:24:28 -03:00

29 lines
685 B
PHP

<?php
namespace Database\Factories;
use App\Models\Workspace;
use App\Models\WorkspaceLabel;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<WorkspaceLabel>
*/
class WorkspaceLabelFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
$colors = ['#FDFD96', '#FFD580', '#FFB3BA', '#FF69B4', '#DDA0DD', '#89CFF0', '#90EE90', '#D2B48C', '#D3D3D3'];
return [
'workspace_id' => Workspace::factory(),
'name' => fake()->word(),
'color' => fake()->randomElement($colors),
];
}
}