@@ -182,7 +182,7 @@ class StripeWebhookController extends Controller
|
||||
]);
|
||||
|
||||
$id = Subscriptions::updateOrCreate(
|
||||
['iam_principal_xid' => $userId,
|
||||
['iam_principal_xid' => $userId,
|
||||
'subscription_product_xid' => $subscriptionProductId],
|
||||
[
|
||||
'subscription_id' => $subscriptionData->subscription,
|
||||
@@ -246,7 +246,7 @@ class StripeWebhookController extends Controller
|
||||
|
||||
Log::info($isCustomReferralCodeApplied);
|
||||
|
||||
|
||||
|
||||
|
||||
ReferralUsers::create([
|
||||
|
||||
@@ -262,7 +262,7 @@ class StripeWebhookController extends Controller
|
||||
$getUserData = IamPrincipal::where('id', $userId)->first();
|
||||
|
||||
$title = "Congratulations your subscription is now active";
|
||||
$message = $getUserData->first_name . " has subscribed for " . $subscriptionProductData->name;
|
||||
$message = $getUserData->first_name . " has subscribed for " . $subscriptionProductData->product->product_name;
|
||||
$content_type = "new_subscription";
|
||||
|
||||
onesignalhelper::sendNotificationApi($getUserData->one_signal_player_id, $title, $message, $content_type, $image = null, $id = null);
|
||||
@@ -323,7 +323,7 @@ class StripeWebhookController extends Controller
|
||||
|
||||
|
||||
$title = "Congratulations your Subscription has been Renewed";
|
||||
$message = $iamPrincialData->first_name . " has subscribed for " . $subscriptionProductData->product_name;
|
||||
$message = $iamPrincialData->first_name . " has subscribed for " . $subscriptionProductData->product->product_name;
|
||||
$content_type = "recurring_subscription";
|
||||
|
||||
onesignalhelper::sendNotificationApi($iamPrincialData->one_signal_player_id, $title, $message, $content_type, $image = null, $id = null);
|
||||
@@ -348,4 +348,4 @@ class StripeWebhookController extends Controller
|
||||
|
||||
return response('Webhook received', 200);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,7 +11,7 @@ class SubscriptionProducts extends Model
|
||||
|
||||
protected $table = 'subscription_products';
|
||||
protected $guarded = [];
|
||||
|
||||
|
||||
protected $fillable =[
|
||||
'id',
|
||||
'product_name',
|
||||
@@ -26,5 +26,10 @@ class SubscriptionProducts extends Model
|
||||
'created_at',
|
||||
'updated_at'
|
||||
];
|
||||
|
||||
|
||||
|
||||
public function product()
|
||||
{
|
||||
return $this->belongsTo(SubscriptionProducts::class, 'subscription_product_xid', 'id');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user