2023-02-23 16:23:00 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace Database\Factories;
|
|
|
|
|
|
|
|
|
|
use App\Models\Survey;
|
|
|
|
|
use App\Models\User;
|
|
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @extends Factory<\App\Models\Survey>
|
|
|
|
|
*/
|
|
|
|
|
final class SurveyFactory extends Factory
|
|
|
|
|
{
|
|
|
|
|
/**
|
2023-06-21 10:24:56 +00:00
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
|
*
|
|
|
|
|
* @var string
|
|
|
|
|
*/
|
2023-02-23 16:23:00 +01:00
|
|
|
protected $model = Survey::class;
|
|
|
|
|
|
|
|
|
|
/**
|
2023-06-21 10:24:56 +00:00
|
|
|
* Define the model's default state.
|
|
|
|
|
*
|
|
|
|
|
* @return array
|
|
|
|
|
*/
|
2023-02-23 16:23:00 +01:00
|
|
|
public function definition(): array
|
|
|
|
|
{
|
|
|
|
|
$is = fake()->boolean;
|
|
|
|
|
return [
|
|
|
|
|
'user_id' => fake()->randomElement(User::pluck('id')),
|
|
|
|
|
'name' => fake()->word,
|
|
|
|
|
'author' => fake()->word,
|
|
|
|
|
'comment' => fake()->word,
|
|
|
|
|
'date' => fake()->dateTime(),
|
|
|
|
|
'documents' => [fake()->word],
|
|
|
|
|
'is_distributor' => ($is) ? 1 : 0,
|
|
|
|
|
'is_customer' => (!$is) ? 1 : 0,
|
|
|
|
|
'deleted_at' => fake()->dateTime(),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|