Skip to content

Commit

Permalink
treat badges as collection
Browse files Browse the repository at this point in the history
  • Loading branch information
cholladay0816 committed Dec 21, 2023
1 parent 4638c01 commit 753ba0f
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use Illuminate\Database\Eloquent\Relations\HasOne;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Illuminate\Notifications\Notifiable;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Cache;
use Laravel\Cashier\Billable;
use Laravel\Fortify\TwoFactorAuthenticatable;
Expand Down Expand Up @@ -116,11 +117,12 @@ public function activeAffiliate(): HasOne|Affiliate
->where('uses', '>', 0);
}

public function getBadges(): array
public function getBadges(): array|Collection
{
$badges = [];
if($this->activeAffiliate()->count()) {
$badges[] .= 'badges.affiliate';
$badges = collect();
if($this->activeAffiliate()->count())
{
$badges->push('badges.affiliate');
}
return $badges;
}
Expand Down

0 comments on commit 753ba0f

Please sign in to comment.