completed story 1.1 with QA tests and fixes

This commit is contained in:
Naser Mansour
2025-12-26 13:46:39 +02:00
parent 028ce573b9
commit 84d9c2f66a
57 changed files with 2193 additions and 85 deletions
+55
View File
@@ -0,0 +1,55 @@
<?php
namespace Database\Factories;
use App\Enums\PostStatus;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Post>
*/
class PostFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'title' => [
'ar' => fake('ar_SA')->sentence(),
'en' => fake()->sentence(),
],
'body' => [
'ar' => fake('ar_SA')->paragraphs(3, true),
'en' => fake()->paragraphs(3, true),
],
'status' => PostStatus::Draft,
'published_at' => null,
];
}
/**
* Create a published post.
*/
public function published(): static
{
return $this->state(fn (array $attributes) => [
'status' => PostStatus::Published,
'published_at' => fake()->dateTimeBetween('-30 days', 'now'),
]);
}
/**
* Create a draft post.
*/
public function draft(): static
{
return $this->state(fn (array $attributes) => [
'status' => PostStatus::Draft,
'published_at' => null,
]);
}
}