jonnybarnes.uk/database/factories/BookmarkFactory.php

39 lines
888 B
PHP
Raw Normal View History

2017-10-10 15:58:07 +01:00
<?php
2020-10-17 17:15:06 +01:00
namespace Database\Factories;
use App\Models\Bookmark;
2020-10-17 17:15:06 +01:00
use Illuminate\Database\Eloquent\Factories\Factory;
use Illuminate\Support\Carbon;
2023-02-18 09:34:57 +00:00
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Bookmark>
*/
2020-10-17 17:15:06 +01:00
class BookmarkFactory extends Factory
{
/**
* The name of the factory's corresponding model.
*
* @var string
*/
protected $model = Bookmark::class;
/**
* Define the model's default state.
*
2023-02-18 09:34:57 +00:00
* @return array<string, mixed>
2020-10-17 17:15:06 +01:00
*/
2023-02-18 09:34:57 +00:00
public function definition(): array
2020-10-17 17:15:06 +01:00
{
$now = Carbon::now()->subDays(rand(5, 15));
return [
'url' => $this->faker->url,
'name' => $this->faker->sentence,
'content' => $this->faker->text,
'created_at' => $now->toDateTimeString(),
'updated_at' => $now->toDateTimeString(),
];
}
}