complet story 6.9 with qa tests

This commit is contained in:
Naser Mansour
2025-12-28 22:51:17 +02:00
parent 102f8553f4
commit 50542e1eb0
17 changed files with 1157 additions and 41 deletions
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace Database\Factories;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Page>
*/
class PageFactory extends Factory
{
/**
* Define the model's default state.
*
* @return array<string, mixed>
*/
public function definition(): array
{
return [
'slug' => fake()->unique()->slug(2),
'title_ar' => fake()->sentence(3),
'title_en' => fake()->sentence(3),
'content_ar' => '<p>'.fake()->paragraphs(3, true).'</p>',
'content_en' => '<p>'.fake()->paragraphs(3, true).'</p>',
];
}
public function terms(): static
{
return $this->state(fn (array $attributes) => [
'slug' => 'terms',
'title_ar' => 'شروط الخدمة',
'title_en' => 'Terms of Service',
]);
}
public function privacy(): static
{
return $this->state(fn (array $attributes) => [
'slug' => 'privacy',
'title_ar' => 'سياسة الخصوصية',
'title_en' => 'Privacy Policy',
]);
}
}
@@ -0,0 +1,32 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('pages', function (Blueprint $table) {
$table->id();
$table->string('slug')->unique();
$table->string('title_ar');
$table->string('title_en');
$table->longText('content_ar')->nullable();
$table->longText('content_en')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('pages');
}
};
+4
View File
@@ -23,5 +23,9 @@ class DatabaseSeeder extends Seeder
'email_verified_at' => now(),
]
);
$this->call([
PageSeeder::class,
]);
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace Database\Seeders;
use App\Models\Page;
use Illuminate\Database\Seeder;
class PageSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
Page::firstOrCreate(
['slug' => 'terms'],
[
'title_ar' => 'شروط الخدمة',
'title_en' => 'Terms of Service',
'content_ar' => '',
'content_en' => '',
]
);
Page::firstOrCreate(
['slug' => 'privacy'],
[
'title_ar' => 'سياسة الخصوصية',
'title_en' => 'Privacy Policy',
'content_ar' => '',
'content_en' => '',
]
);
}
}