'int', 'reward_points' => 'int', ]; } public function user(): BelongsTo { return $this->belongsTo(User::class); } public function tier(): BelongsTo { return $this->belongsTo(Tier::class); } #[Scope] protected function scopeForSpending(Builder $query, $totalSpending): void { $query ->where('min_spending', '<=', $totalSpending) ->where(function ($q) use ($totalSpending) { $q->whereNull('max_spending') ->orWhere('max_spending', '>=', $totalSpending); }); } }