feat: add quarter field to company history items with localization support, enhancing data organization and user experience

This commit is contained in:
Ümit Tunç
2026-05-21 20:16:32 +03:00
parent cc6ca1f660
commit 2018860c23
8 changed files with 133 additions and 5 deletions
+7 -1
View File
@@ -11,8 +11,11 @@ class CompanyHistoryItem extends Model
{
use HasFactory, SoftDeletes, HasTranslations;
public const QUARTERS = ['Q1', 'Q2', 'Q3', 'Q4'];
protected $fillable = [
'year',
'quarter',
'title',
'content',
'color',
@@ -43,7 +46,10 @@ class CompanyHistoryItem extends Model
public function scopeOrdered($query)
{
return $query->orderBy('sort_order', 'asc')->orderBy('year', 'asc');
return $query
->orderBy('year', 'asc')
->orderByRaw("CASE quarter WHEN 'Q1' THEN 1 WHEN 'Q2' THEN 2 WHEN 'Q3' THEN 3 WHEN 'Q4' THEN 4 ELSE 5 END")
->orderBy('sort_order', 'asc');
}
public function getResolvedPositionAttribute(): string