b2in/database/factories/CmsProjectFactory.php
2026-04-10 17:18:17 +02:00

80 lines
2.7 KiB
PHP

<?php
namespace Database\Factories;
use App\Models\CmsProject;
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
/**
* @extends Factory<CmsProject>
*/
class CmsProjectFactory extends Factory
{
protected $model = CmsProject::class;
public function definition(): array
{
$title = fake()->words(3, true);
return [
'slug' => Str::slug($title).'-'.fake()->unique()->numberBetween(100, 999),
'title' => ucfirst($title),
'location' => fake()->city().', '.fake()->country(),
'status' => fake()->randomElement(['NEW LAUNCH', 'SOLD OUT', 'AVAILABLE', null]),
'launch_date' => fake()->dateTimeBetween('-1 year', '+1 year'),
'price_from_aed' => fake()->numberBetween(500_000, 10_000_000),
'currency' => 'AED',
'image' => 'expose/placeholder.jpg',
'highlights' => [
fake()->sentence(4),
fake()->sentence(4),
fake()->sentence(4),
],
'quick_facts' => [
['icon' => 'home-modern', 'label' => 'Typen', 'value' => '1BR & 2BR'],
['icon' => 'squares-2x2', 'label' => 'Größe', 'value' => fake()->numberBetween(400, 2000).' sqft'],
['icon' => 'building-office-2', 'label' => 'Einheiten', 'value' => fake()->numberBetween(50, 500)],
['icon' => 'user', 'label' => 'Entwickler', 'value' => fake()->company()],
],
'investment_case' => [
'title' => fake()->sentence(5),
'text' => fake()->paragraph(3),
'views' => [fake()->word(), fake()->word()],
],
'gallery' => [],
'location_info' => [
'title' => 'Location: '.fake()->city(),
'map_url' => 'https://maps.google.com/?q='.urlencode(fake()->city()),
'points' => [
fake()->sentence(6),
fake()->sentence(6),
],
],
'contact' => [
'title' => fake()->sentence(5),
'subtitle' => fake()->sentence(3),
'options' => [
'' => 'Ich interessiere mich für...',
'general' => 'Allgemeine Beratung',
],
],
'is_published' => true,
'order' => 0,
];
}
public function published(): static
{
return $this->state(fn (array $attributes) => [
'is_published' => true,
]);
}
public function unpublished(): static
{
return $this->state(fn (array $attributes) => [
'is_published' => false,
]);
}
}