Files
landing-api/database/factories/TalkFactory.php
Josep Piguillem 3897113313 Initial commit: Pireon Admin — headless admin panel and public API
Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer
collective, backed by the Pireon OAuth identity server. The public site is a
separate, server-rendered application consuming /api/public/v1.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-19 17:55:27 +02:00

45 lines
1.3 KiB
PHP

<?php
declare(strict_types=1);
namespace Database\Factories;
use App\Models\Talk;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends Factory<Talk>
*/
class TalkFactory extends Factory
{
protected $model = Talk::class;
/**
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'title' => rtrim(fake()->unique()->catchPhrase(), '.'),
'language' => (string) config('locales.default'),
'summary' => $this->eachLocale(fn () => fake()->sentence(14)),
'event' => fake()->randomElement([
'Codemotion', 'T3chFest', 'JSDay', 'PHPBarcelona', 'Meetup Laravel',
]),
'city' => fake()->randomElement(['Madrid', 'Barcelona', 'Valencia', 'Sevilla']),
'held_at' => fake()->dateTimeBetween('-3 years'),
'video_url' => fake()->optional(0.6)->url(),
'slides_url' => fake()->optional(0.4)->url(),
'is_public' => true,
];
}
/** @return array<string, string> */
protected function eachLocale(callable $value): array
{
return collect(array_keys(config('locales.supported')))
->mapWithKeys(fn (string $l) => [$l => $value($l)])
->all();
}
}