fn ($q) => $q->whereNotIn('gateway', [Transaction::GATEWAYS['cafe'], Transaction::GATEWAYS['myket']])->whereDate('expire_at', now()->subDay()), 'products.packageName', ])->whereHas('products', fn ($q) => $q->whereDate('expire_at', now()->subDay()))->chunkById(300, function ($users) { foreach ($users as $user) { $link = config('redirects.' . str_replace('.', '*', $user->products[0]->packageName->name)); dump($user->mobile); SendSMSJob::dispatch([ 'mobile' => $user->mobile, 'message' => "کاربرعزیز اشتراک برنامه {$user->products[0]->packageName->title} برای شما به پایان رسید برای تمدید کلیک کنید $link" ]); } }); } }