*/ protected $translatable = [ 'title', 'content', ]; protected $casts = [ 'year' => 'integer', 'is_active' => 'boolean', 'sort_order' => 'integer', ]; public function scopeActive($query) { return $query->where('is_active', true); } public function scopeOrdered($query) { 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 { if (in_array($this->position, ['left', 'right'], true)) { return $this->position; } return ($this->sort_order % 2 === 1) ? 'right' : 'left'; } }