ldc-legaulois/database/factories/SubrangeFactory.php

34 lines
939 B
PHP
Raw Permalink Normal View History

2024-04-12 13:41:57 +00:00
<?php
namespace Database\Factories;
use App\Models\Range;
2024-04-12 13:41:57 +00:00
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Str;
class SubrangeFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
2024-04-12 13:41:57 +00:00
{
$label = fake()->unique()->words(rand(1, 2), true);
2026-09-25 16:25:31 +02:00
2024-04-12 13:41:57 +00:00
return [
'label' => $label,
'subtitle' => fake()->text(10),
'slug' => Str::slug($label),
'description' => fake()->sentence(),
'picture' => '',
'picture_alt' => fake()->sentence(),
'picture_title' => fake()->sentence(),
'range_id' => Range::query()->where('published', true)->inRandomOrder()->value('id'),
'order' => 1,
'published' => fake()->boolean(75),
2024-04-12 13:41:57 +00:00
];
}
}