| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- <?php
- namespace App\Notifications\Push\Cliente\SocialProof;
- use App\Enums\PushNotificationCategoryEnum;
- use App\Enums\PushNotificationTargetEnum;
- use App\Models\User;
- use App\Notifications\Push\BasePushNotification;
- use Illuminate\Database\Eloquent\Collection;
- class SocialProof1Push extends BasePushNotification
- {
- public function label(): string
- {
- return 'cliente_social_proof_1';
- }
- public function title(): string
- {
- return 'Clientes como você';
- }
- public function body(): string
- {
- return 'Já estão usando o Diária para facilitar a rotina.';
- }
- public function target(): PushNotificationTargetEnum
- {
- return PushNotificationTargetEnum::CLIENTE;
- }
- public function category(): PushNotificationCategoryEnum
- {
- return PushNotificationCategoryEnum::SOCIAL_PROOF;
- }
- public function notificationCooldownDays(): int
- {
- return 28;
- }
- public function categoryCooldownDays(): int
- {
- return 14;
- }
- /**
- * Elegível se:
- * - Nunca teve agendamento com status finished
- * - OU último agendamento finished foi há >30 dias
- */
- public function eligibleUsers(): Collection
- {
- return User::whereHas('client')
- ->where('registration_complete', true)
- ->where(function ($query) {
- $query->whereDoesntHave('client.schedules', fn ($q) => $q->where('status', 'finished'))
- ->orWhereDoesntHave('client.schedules', fn ($q) => $q->where('status', 'finished')
- ->where('updated_at', '>=', now()->subDays(30)));
- })
- ->get();
- }
- }
|