complete story 5.1 with qa tests

This commit is contained in:
Naser Mansour
2025-12-27 01:33:05 +02:00
parent 30d0d46566
commit 8e3daddb1d
15 changed files with 1530 additions and 30 deletions
+9
View File
@@ -5,6 +5,7 @@ namespace App\Models;
use App\Enums\PostStatus;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Str;
class Post extends Model
{
@@ -62,4 +63,12 @@ class Post extends Model
return $this->body[$locale] ?? $this->body['ar'] ?? '';
}
/**
* Get the excerpt by stripping HTML and limiting to 150 characters.
*/
public function getExcerpt(?string $locale = null): string
{
return Str::limit(strip_tags($this->getBody($locale)), 150);
}
}