forked from eatvio/eatvio-infra
56 lines
1.8 KiB
PHP
Executable File
56 lines
1.8 KiB
PHP
Executable File
<?php
|
|
|
|
namespace Database\Factories;
|
|
use Illuminate\Http\UploadedFile;
|
|
use Illuminate\Support\Facades\Storage;
|
|
use FakerRestaurant\Provider\en_US\Restaurant;
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Plan>
|
|
*/
|
|
class PlanFactory extends Factory
|
|
{
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$faker = \Faker\Factory::create();
|
|
$this->faker->addProvider(new Restaurant($faker));
|
|
|
|
$typeBody = [
|
|
'fit' => $this->faker->boolean(),
|
|
'slim' => $this->faker->boolean(),
|
|
'behavior' => $this->faker->boolean(),
|
|
'wellness' => $this->faker->boolean(),
|
|
];
|
|
|
|
$packetsOptions = [
|
|
'items' => [$this->faker->fruitName(), $this->faker->meatName(), $this->faker->sauceName()],
|
|
'price' => $this->faker->randomNumber(),
|
|
'short' => $this->faker->foodName(),
|
|
'description' => $this->faker->text(),
|
|
];
|
|
|
|
Storage::fake('plans');
|
|
|
|
return [
|
|
'name' => $this->faker->foodName(),
|
|
// 'image' => UploadedFile::fake()->image('plans/Photo_C.png'),
|
|
'image' => UploadedFile::fake()->image('plan.png'),
|
|
'duration' => $this->faker->randomElement([7, 14,21]),
|
|
'state' => $this->faker->randomElement(['active', 'draft', 'archived']),
|
|
'type' => $typeBody,
|
|
'details' => $this->faker->text(),
|
|
'packets_count' => $this->faker->randomElement([1, 3]),
|
|
'packet1_options' => $packetsOptions,
|
|
'packet2_options' => $packetsOptions,
|
|
'packet3_options' => $packetsOptions,
|
|
];
|
|
}
|
|
}
|