Files
bogazici-api/database/factories/CourseFactory.php
2026-03-27 10:41:54 +03:00

46 lines
1.6 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

<?php
namespace Database\Factories;
use App\Models\Category;
use App\Models\Course;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<Course>
*/
class CourseFactory extends Factory
{
/**
* @return array<string, mixed>
*/
public function definition(): array
{
$title = fake()->unique()->words(3, true);
return [
'category_id' => Category::factory(),
'slug' => Str::slug($title),
'title' => ucfirst($title),
'sub' => fake()->optional()->word(),
'desc' => fake()->paragraph(),
'long_desc' => fake()->paragraphs(3, true),
'duration' => fake()->randomElement(['3 Gün', '5 Gün', '10 Gün', '2 Hafta']),
'students' => fake()->numberBetween(0, 500),
'rating' => fake()->randomFloat(1, 3.0, 5.0),
'badge' => fake()->optional()->randomElement(['Simülatör', 'Online', 'Yüz Yüze']),
'image' => null,
'price' => fake()->optional()->randomElement(['2.500 TL', '5.000 TL', '7.500 TL', '10.000 TL']),
'includes' => fake()->words(4),
'requirements' => fake()->words(3),
'meta_title' => fake()->sentence(4),
'meta_description' => fake()->sentence(10),
'scope' => fake()->words(5),
'standard' => fake()->optional()->randomElement(['STCW Uyumlu', 'IMO Uyumlu', 'STCW / IMO Uyumlu']),
'language' => 'Türkçe',
'location' => fake()->optional()->randomElement(['Kadıköy, İstanbul', 'Tuzla, İstanbul', 'Beşiktaş, İstanbul']),
];
}
}