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
+39
View File
@@ -0,0 +1,39 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Page extends Model
{
use HasFactory;
protected $fillable = [
'slug',
'title_ar',
'title_en',
'content_ar',
'content_en',
];
/**
* Get the title in the specified locale, with fallback to Arabic.
*/
public function getTitle(?string $locale = null): string
{
$locale ??= app()->getLocale();
return $locale === 'en' ? ($this->title_en ?? $this->title_ar) : $this->title_ar;
}
/**
* Get the content in the specified locale, with fallback to Arabic.
*/
public function getContent(?string $locale = null): string
{
$locale ??= app()->getLocale();
return $locale === 'en' ? ($this->content_en ?? $this->content_ar ?? '') : ($this->content_ar ?? '');
}
}