From 9856c5bdcb6aa5d46c8a1116a81ff0a3749565b2 Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 4 Mar 2024 13:34:16 +0000 Subject: [PATCH 1/3] Adds L11 docs --- src/installation.md | 8 ++++---- src/spark-paddle/customization.md | 20 -------------------- src/spark-paddle/middleware.md | 13 +++++++------ src/spark-stripe/customization.md | 20 -------------------- src/spark-stripe/middleware.md | 13 +++++++------ 5 files changed, 18 insertions(+), 56 deletions(-) diff --git a/src/installation.md b/src/installation.md index d403755..ff8c1fb 100644 --- a/src/installation.md +++ b/src/installation.md @@ -24,8 +24,8 @@ Next, you may add the `laravel/spark-paddle` or `laravel/spark-stripe` package t ```json "require": { - "php": "^8.1", - "laravel/framework": "^10.0", + "php": "^8.2", + "laravel/framework": "^11.0", "laravel/spark-paddle": "^5.0" }, ``` @@ -95,8 +95,8 @@ If your Spark license has expired and you don't want to renew the license your ` ```json "require": { - "php": "^8.1", - "laravel/framework": "^10.0", + "php": "^8.2", + "laravel/framework": "^11.0", "laravel/spark-paddle": "5.y.z" }, ``` diff --git a/src/spark-paddle/customization.md b/src/spark-paddle/customization.md index d81146d..e348cd1 100644 --- a/src/spark-paddle/customization.md +++ b/src/spark-paddle/customization.md @@ -95,23 +95,3 @@ class PaddleEventListener } } ``` - -Next, the listener should be registered in your application's `App\Providers\EventServiceProvider` class: - -```php -use App\Listeners\PaddleEventListener; -use Laravel\Paddle\Events\WebhookReceived; - -class EventServiceProvider extends ServiceProvider -{ - /** - * The event handler mappings for the application. - * - * @var array - */ - protected $listen = [ - WebhookReceived::class => [ - PaddleEventListener::class, - ], - ]; -``` diff --git a/src/spark-paddle/middleware.md b/src/spark-paddle/middleware.md index 8fc3bd0..1b4ab87 100644 --- a/src/spark-paddle/middleware.md +++ b/src/spark-paddle/middleware.md @@ -4,18 +4,19 @@ When building a subscription based application, you will commonly need to restrict access to certain routes to users that have a valid subscription. For example, you may not want to let a user create a project if they are not subscribed to a billing plan. For that reason, Spark provides a convenient subscription verification [middleware](https://laravel.com/docs/middleware) that you may register with your application. -To get started, register Spark's subscription verification middleware in your HTTP kernel's `$routeMiddleware` array. Your application's HTTP kernel is typically located at `app/Http/Kernel.php`: +To get started, register the alias for Spark's subscription verification middleware by using the `alias` middleware method in your application's `bootstrap/app.php` file: ```php use Spark\Http\Middleware\VerifyBillableIsSubscribed; -protected $routeMiddleware = [ - // ... - 'subscribed' => VerifyBillableIsSubscribed::class -]; +->withMiddleware(function (Middleware $middleware) { + $middleware->alias([ + 'subscribed' => VerifyBillableIsSubscribed::class + ]); +}) ``` -Once the middleware has been registered, you may attach it to any of your application's route definitions: +Once the middleware alias has been registered, you may attach it to any of your application's route definitions: ```php Route::post('/projects', [ProjectController::class, 'store']) diff --git a/src/spark-stripe/customization.md b/src/spark-stripe/customization.md index d8d1394..fb90e59 100644 --- a/src/spark-stripe/customization.md +++ b/src/spark-stripe/customization.md @@ -101,23 +101,3 @@ class StripeEventListener } } ``` - -Next, the listener should be registered in your application's `App\Providers\EventServiceProvider` class: - -```php -use App\Listeners\StripeEventListener; -use Laravel\Cashier\Events\WebhookReceived; - -class EventServiceProvider extends ServiceProvider -{ - /** - * The event handler mappings for the application. - * - * @var array - */ - protected $listen = [ - WebhookReceived::class => [ - StripeEventListener::class, - ], - ]; -``` diff --git a/src/spark-stripe/middleware.md b/src/spark-stripe/middleware.md index 48166bc..90052bf 100644 --- a/src/spark-stripe/middleware.md +++ b/src/spark-stripe/middleware.md @@ -4,18 +4,19 @@ When building a subscription based application, you will commonly need to restrict access to certain routes to users that have an active subscription. For example, you may not want to let a user create a project if they are not subscribed to a billing plan. For that reason, Spark provides a convenient subscription verification [middleware](https://laravel.com/docs/middleware) that you may register with your application. -To get started, register Spark's subscription verification middleware in your HTTP kernel's `$routeMiddleware` array. Your application's HTTP kernel is typically located at `app/Http/Kernel.php`: +To get started, register the alias for Spark's subscription verification middleware by using the `alias` middleware method in your application's `bootstrap/app.php` file: ```php use Spark\Http\Middleware\VerifyBillableIsSubscribed; -protected $routeMiddleware = [ - // ... - 'subscribed' => VerifyBillableIsSubscribed::class -]; +->withMiddleware(function (Middleware $middleware) { + $middleware->alias([ + 'subscribed' => VerifyBillableIsSubscribed::class + ]); +}) ``` -Once the middleware has been registered, you may attach it to any of your application's route definitions: +Once the middleware alias has been registered, you may attach it to any of your application's route definitions: ```php Route::post('/projects', [ProjectController::class, 'store']) From e199b9035bad739ad57b928c06c5981a6f4284fc Mon Sep 17 00:00:00 2001 From: Nuno Maduro Date: Mon, 4 Mar 2024 14:18:27 +0000 Subject: [PATCH 2/3] Adjusts --- src/spark-paddle/middleware.md | 16 ++++++++-------- src/spark-stripe/middleware.md | 16 ++++++++-------- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/src/spark-paddle/middleware.md b/src/spark-paddle/middleware.md index 1b4ab87..fe6c8dd 100644 --- a/src/spark-paddle/middleware.md +++ b/src/spark-paddle/middleware.md @@ -2,21 +2,21 @@ [[toc]] -When building a subscription based application, you will commonly need to restrict access to certain routes to users that have a valid subscription. For example, you may not want to let a user create a project if they are not subscribed to a billing plan. For that reason, Spark provides a convenient subscription verification [middleware](https://laravel.com/docs/middleware) that you may register with your application. +When building a subscription based application, you will commonly need to restrict access to certain routes to users that have an active subscription. For example, you may not want to let a user create a project if they are not subscribed to a billing plan. For that reason, Spark provides a convenient subscription verification [middleware](https://laravel.com/docs/middleware) that you may use in your application's routes. -To get started, register the alias for Spark's subscription verification middleware by using the `alias` middleware method in your application's `bootstrap/app.php` file: +If your application uses Laravel 11's new application structure, where the `bootstrap/app.php` file is used to configure the application, then the Spark's subscription verification middleware alias is automatically registered for you. However, if you are using an application structure that does not include the `bootstrap/app.php` file, you may need to manually register the `subscribed` middleware alias in your application's `App\Http\Kernel` class: ```php use Spark\Http\Middleware\VerifyBillableIsSubscribed; -->withMiddleware(function (Middleware $middleware) { - $middleware->alias([ - 'subscribed' => VerifyBillableIsSubscribed::class - ]); -}) +protected $middlewareAliases = [ + // ... + + 'subscribed' => VerifyBillableIsSubscribed::class +]; ``` -Once the middleware alias has been registered, you may attach it to any of your application's route definitions: +Finally, you may attach the `subscribed` middleware to any of your application's route definitions: ```php Route::post('/projects', [ProjectController::class, 'store']) diff --git a/src/spark-stripe/middleware.md b/src/spark-stripe/middleware.md index 90052bf..6fc7419 100644 --- a/src/spark-stripe/middleware.md +++ b/src/spark-stripe/middleware.md @@ -2,21 +2,21 @@ [[toc]] -When building a subscription based application, you will commonly need to restrict access to certain routes to users that have an active subscription. For example, you may not want to let a user create a project if they are not subscribed to a billing plan. For that reason, Spark provides a convenient subscription verification [middleware](https://laravel.com/docs/middleware) that you may register with your application. +When building a subscription based application, you will commonly need to restrict access to certain routes to users that have an active subscription. For example, you may not want to let a user create a project if they are not subscribed to a billing plan. For that reason, Spark provides a convenient subscription verification [middleware](https://laravel.com/docs/middleware) that you may use in your application's routes. -To get started, register the alias for Spark's subscription verification middleware by using the `alias` middleware method in your application's `bootstrap/app.php` file: +If your application uses Laravel 11's new application structure, where the `bootstrap/app.php` file is used to configure the application, then the Spark's subscription verification middleware alias is automatically registered for you. However, if you are using an application structure that does not include the `bootstrap/app.php` file, you may need to manually register the `subscribed` middleware alias in your application's `App\Http\Kernel` class: ```php use Spark\Http\Middleware\VerifyBillableIsSubscribed; -->withMiddleware(function (Middleware $middleware) { - $middleware->alias([ - 'subscribed' => VerifyBillableIsSubscribed::class - ]); -}) +protected $middlewareAliases = [ + // ... + + 'subscribed' => VerifyBillableIsSubscribed::class +]; ``` -Once the middleware alias has been registered, you may attach it to any of your application's route definitions: +Finally, you may attach the `subscribed` middleware to any of your application's route definitions: ```php Route::post('/projects', [ProjectController::class, 'store']) From b6fc55ecf3327c0e845d446ec081957cc5459104 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Mon, 4 Mar 2024 08:49:01 -0600 Subject: [PATCH 3/3] formatting --- src/spark-paddle/middleware.md | 6 +++--- src/spark-stripe/middleware.md | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/spark-paddle/middleware.md b/src/spark-paddle/middleware.md index fe6c8dd..3badda9 100644 --- a/src/spark-paddle/middleware.md +++ b/src/spark-paddle/middleware.md @@ -2,9 +2,9 @@ [[toc]] -When building a subscription based application, you will commonly need to restrict access to certain routes to users that have an active subscription. For example, you may not want to let a user create a project if they are not subscribed to a billing plan. For that reason, Spark provides a convenient subscription verification [middleware](https://laravel.com/docs/middleware) that you may use in your application's routes. +When building a subscription based application, you will commonly need to restrict access to certain routes to users that have an active subscription. For example, you may not want to let a user create a project if they are not subscribed to a billing plan. For that reason, Spark provides a convenient subscription verification [middleware](https://laravel.com/docs/middleware) that you may assign to your application's routes. -If your application uses Laravel 11's new application structure, where the `bootstrap/app.php` file is used to configure the application, then the Spark's subscription verification middleware alias is automatically registered for you. However, if you are using an application structure that does not include the `bootstrap/app.php` file, you may need to manually register the `subscribed` middleware alias in your application's `App\Http\Kernel` class: +If your application uses Laravel 11's streamlined application structure which configures middleware within the `bootstrap/app.php` file, then Spark's subscription verification middleware alias is automatically registered for you internally. However, if you are using an application structure that does not utilize the `bootstrap/app.php` file for middleware configuration, you may need to manually register the `subscribed` middleware alias in your application's `App\Http\Kernel` class: ```php use Spark\Http\Middleware\VerifyBillableIsSubscribed; @@ -16,7 +16,7 @@ protected $middlewareAliases = [ ]; ``` -Finally, you may attach the `subscribed` middleware to any of your application's route definitions: +Then, you may attach the `subscribed` middleware to any of your application's route definitions: ```php Route::post('/projects', [ProjectController::class, 'store']) diff --git a/src/spark-stripe/middleware.md b/src/spark-stripe/middleware.md index 6fc7419..2421031 100644 --- a/src/spark-stripe/middleware.md +++ b/src/spark-stripe/middleware.md @@ -2,9 +2,9 @@ [[toc]] -When building a subscription based application, you will commonly need to restrict access to certain routes to users that have an active subscription. For example, you may not want to let a user create a project if they are not subscribed to a billing plan. For that reason, Spark provides a convenient subscription verification [middleware](https://laravel.com/docs/middleware) that you may use in your application's routes. +When building a subscription based application, you will commonly need to restrict access to certain routes to users that have an active subscription. For example, you may not want to let a user create a project if they are not subscribed to a billing plan. For that reason, Spark provides a convenient subscription verification [middleware](https://laravel.com/docs/middleware) that you may assign to your application's routes. -If your application uses Laravel 11's new application structure, where the `bootstrap/app.php` file is used to configure the application, then the Spark's subscription verification middleware alias is automatically registered for you. However, if you are using an application structure that does not include the `bootstrap/app.php` file, you may need to manually register the `subscribed` middleware alias in your application's `App\Http\Kernel` class: +If your application uses Laravel 11's streamlined application structure which configures middleware within the `bootstrap/app.php` file, then Spark's subscription verification middleware alias is automatically registered for you internally. However, if you are using an application structure that does not utilize the `bootstrap/app.php` file for middleware configuration, you may need to manually register the `subscribed` middleware alias in your application's `App\Http\Kernel` class: ```php use Spark\Http\Middleware\VerifyBillableIsSubscribed; @@ -16,7 +16,7 @@ protected $middlewareAliases = [ ]; ``` -Finally, you may attach the `subscribed` middleware to any of your application's route definitions: +Then, you may attach the `subscribed` middleware to any of your application's route definitions: ```php Route::post('/projects', [ProjectController::class, 'store'])