You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: src/docs/utils/billing.md
+15-4Lines changed: 15 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -563,8 +563,8 @@ Leaf billing comes with a middleware that you can use to protect your routes bas
563
563
|`billing.subscribed:plan-name`| Protect a route to only allow users subscribed to a specific plan |
564
564
|`billing.not-subscribed`| Protect a route to only allow users who aren't subscribed |
565
565
|`billing.not-subscribed:plan-name`| Protect a route to only allow users not subscribed to a specific plan |
566
-
|`billing.trial`| Protect a route to only allow users on a trial period |
567
-
|`billing.not-trial`| Protect a route to only allow users not on a trial period |
566
+
<!--| `billing.trial` | Protect a route to only allow users on a trial period |
567
+
| `billing.not-trial` | Protect a route to only allow users not on a trial period |-->
568
568
569
569
You can use these middlewares in your routes like this:
570
570
@@ -577,7 +577,7 @@ app()->get('/protected', [
577
577
]);
578
578
579
579
app()->get('/protected', [
580
-
'middleware' => 'billing.not-subscribed',
580
+
'middleware' => 'billing.not-subscribed:Starter',
581
581
'SubscriptionController@subscribe'
582
582
]);
583
583
```
@@ -586,10 +586,21 @@ If you want to customize what the middleware does if the user is not allowed to
586
586
587
587
```php:no-line-numbers [index.php]
588
588
billing()->middleware('billing.subscribed', function () {
589
-
response()->redirect('/billing/subscribe');
589
+
response()->redirect('/some-special-page');
590
590
});
591
591
```
592
592
593
+
And then you can use the middleware like this:
594
+
595
+
```php [_some-route.php]
596
+
app()->get('/protected', [
597
+
'middleware' => 'billing.subscribed',
598
+
function() {
599
+
return 'You are subscribed';
600
+
}
601
+
]);
602
+
```
603
+
593
604
<!-- ## Billing Currency
594
605
595
606
PayStack is only available in Africa, and relies on local currency. Stripe is available globally and supports multiple currencies, so Leaf's billing allows you to set your currency in your `.env` file.
0 commit comments