You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
aquaculture/database/factories/CarsFactory.php

36 lines
943 B

<?php
namespace Database\Factories;
use App\Models\Car;
use App\Models\Product;
use App\Models\User;
use Illuminate\Database\Eloquent\Factories\Factory;
/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/
class CarsFactory extends Factory
{
protected $model = Car::class;
public function definition(): array
{
return [
'user_id' => User::inRandomOrder()->first()->id,
'product_id' => Product::inRandomOrder()->first()->id,
'number' => mt_rand(1, 5),
'created_at' => time(),
'updated_at' => time()
];
}
}