@@ -32,7 +32,7 @@ discard block |
||
| 32 | 32 | $plan = $subscription['plan']; |
| 33 | 33 | if ($plan) { |
| 34 | 34 | $plan_nickname = $plan[['nickName']]; |
| 35 | - $roles= Role::where('name', strtolower($plan->nickname))->first(); |
|
| 35 | + $roles = Role::where('name', strtolower($plan->nickname))->first(); |
|
| 36 | 36 | if ($roles) { |
| 37 | 37 | $user->role_id = $roles->id; |
| 38 | 38 | $user->save(); |
@@ -41,7 +41,7 @@ discard block |
||
| 41 | 41 | |
| 42 | 42 | } |
| 43 | 43 | case "invoice.payment_failed" : |
| 44 | - $roles= Role::where('name', strtolower("free"))->first(); |
|
| 44 | + $roles = Role::where('name', strtolower("free"))->first(); |
|
| 45 | 45 | if ($roles) { |
| 46 | 46 | $user->role_id = $roles->id; |
| 47 | 47 | $user->save(); |
@@ -21,10 +21,11 @@ |
||
| 21 | 21 | $data = request()->all(); |
| 22 | 22 | $user = User::where('stripe_id', $data['data']['object']['customer'])->first(); |
| 23 | 23 | if ($user) { |
| 24 | - if ($data['type'] === 'customer.subscription.deleted' || customer.subscription.deleted) |
|
| 25 | - switch ($data['type']) { |
|
| 24 | + if ($data['type'] === 'customer.subscription.deleted' || customer.subscription.deleted) { |
|
| 25 | + switch ($data['type']) { |
|
| 26 | 26 | case "customer.subscription.deleted": |
| 27 | 27 | $user->role_id = 4; |
| 28 | + } |
|
| 28 | 29 | $user->save(); |
| 29 | 30 | break; |
| 30 | 31 | case "invoice.payment_succeeded" : |