*/ class ContentRecapFactory extends Factory { protected $model = ContentRecap::class; /** * Define the model's default state. * * @return array */ public function definition(): array { $channels = [ 'Website', 'Facebook', 'Instagram', 'Twitter', 'YouTube', 'TikTok', 'WhatsApp', 'Telegram', 'LinkedIn', ]; $socialMediaPlatforms = [ 'Facebook', 'Instagram', 'Twitter', 'YouTube', 'TikTok', 'LinkedIn', 'WhatsApp', 'Telegram', 'Pinterest', ]; return [ 'classification_id' => Classification::factory(), 'title' => $this->faker->sentence(4), 'link' => $this->faker->optional(0.8)->url(), 'posting_date' => $this->faker->dateTimeBetween('-6 months', 'now')->format('Y-m-d'), 'type' => $this->faker->randomElement(ContentType::cases())->value, 'channel' => $this->faker->randomElement($channels), 'social_media' => $this->faker->randomElement($socialMediaPlatforms), ]; } /** * Indicate that the content recap is photo type. */ public function photo(): static { return $this->state(fn (array $attributes) => [ 'type' => ContentType::FOTO->value, ]); } /** * Indicate that the content recap is video type. */ public function video(): static { return $this->state(fn (array $attributes) => [ 'type' => ContentType::VIDEO->value, 'channel' => $this->faker->randomElement(['YouTube', 'Instagram', 'TikTok']), ]); } /** * Indicate that the content recap is text type. */ public function text(): static { return $this->state(fn (array $attributes) => [ 'type' => ContentType::TEXT->value, ]); } /** * Indicate that the content recap is graphic type. */ public function graphic(): static { return $this->state(fn (array $attributes) => [ 'type' => ContentType::GRAPHIC->value, ]); } /** * Indicate that the content recap is for Instagram. */ public function instagram(): static { return $this->state(fn (array $attributes) => [ 'channel' => 'Instagram', 'social_media' => 'Instagram', ]); } /** * Indicate that the content recap is for Facebook. */ public function facebook(): static { return $this->state(fn (array $attributes) => [ 'channel' => 'Facebook', 'social_media' => 'Facebook', ]); } }