diff --git a/app/Models/Goal.php b/app/Models/Goal.php index 1d52576..8f00123 100644 --- a/app/Models/Goal.php +++ b/app/Models/Goal.php @@ -86,19 +86,16 @@ final class Goal extends Model /** * Get the days for the goals as strings in array keyed by dow. */ - public function getDaysFormattedAttribute(): array { - $days = []; + public function getDaysFormattedAttribute(): Collection { if (empty($this->days)) { - return $days; + return new Collection([]); } - - self::days()->each(function ($day) use (&$days) { + return self::days()->filter(function ($day) { if (($this->days & $day['value']) != 0) { - $days[$day['dow']] = $day['label']; + return true; } + return false; }); - - return $days; } /** diff --git a/resources/views/goals/index.blade.php b/resources/views/goals/index.blade.php index 943e471..1bd4d48 100644 --- a/resources/views/goals/index.blade.php +++ b/resources/views/goals/index.blade.php @@ -13,25 +13,25 @@