2017-09-04 19:34:39 +01:00
|
|
|
<?php
|
|
|
|
|
2020-10-17 17:15:06 +01:00
|
|
|
namespace Database\Factories;
|
|
|
|
|
2017-12-22 14:28:41 +00:00
|
|
|
use App\Models\Note;
|
2021-08-31 12:28:00 +01:00
|
|
|
use Exception;
|
2020-10-17 17:15:06 +01:00
|
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
2019-07-26 10:40:56 +01:00
|
|
|
use Illuminate\Support\Carbon;
|
2017-09-04 19:34:39 +01:00
|
|
|
|
2023-02-18 09:34:57 +00:00
|
|
|
/**
|
2023-07-28 11:48:07 +01:00
|
|
|
* @psalm-suppress UnusedClass
|
2023-07-28 12:05:11 +01:00
|
|
|
*
|
2023-02-18 09:34:57 +00:00
|
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Note>
|
|
|
|
*/
|
2020-10-17 17:15:06 +01:00
|
|
|
class NoteFactory extends Factory
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* The name of the factory's corresponding model.
|
|
|
|
*
|
|
|
|
* @var string
|
|
|
|
*/
|
|
|
|
protected $model = Note::class;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Define the model's default state.
|
|
|
|
*
|
2023-02-18 09:34:57 +00:00
|
|
|
* @return array<string, mixed>
|
2022-07-09 10:08:26 +01:00
|
|
|
*
|
2021-08-31 12:28:00 +01:00
|
|
|
* @throws Exception
|
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
|
|
|
{
|
2021-08-31 12:28:00 +01:00
|
|
|
$now = Carbon::now()->subDays(random_int(5, 15));
|
2020-10-17 17:15:06 +01:00
|
|
|
|
|
|
|
return [
|
|
|
|
'note' => $this->faker->paragraph,
|
|
|
|
'created_at' => $now,
|
|
|
|
'updated_at' => $now,
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|