feat: add quarter field to company history items with localization support, enhancing data organization and user experience
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user