'int', 'stock' => 'int', 'category' => RewardCategory::class, 'is_show' => IsShow::class, ]; } #[Scope] protected function show(Builder $query): void { $query->where('is_show', IsShow::SHOW); } #[Scope] protected function hide(Builder $query): void { $query->where('is_show', IsShow::HIDDEN); } #[Scope] protected function active(Builder $query): void { $query->whereDate('start_date', '<=', now()) ->where(function ($q) { $q->whereNull('end_date') ->orWhereDate('end_date', '>=', now()); }); } public function tiers(): BelongsToMany { return $this->belongsToMany(Tier::class); } public function redemptions(): HasMany { return $this->hasMany(Redemption::class); } }