Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -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"
},
```
Expand Down Expand Up @@ -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"
},
```
20 changes: 0 additions & 20 deletions src/spark-paddle/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
];
```
9 changes: 5 additions & 4 deletions src/spark-paddle/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +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 assign to your application's routes.

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`:
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;

protected $routeMiddleware = [
protected $middlewareAliases = [
// ...

'subscribed' => VerifyBillableIsSubscribed::class
];
```

Once the middleware has been registered, you may attach it 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'])
Expand Down
20 changes: 0 additions & 20 deletions src/spark-stripe/customization.md
Original file line number Diff line number Diff line change
Expand Up @@ -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,
],
];
```
9 changes: 5 additions & 4 deletions src/spark-stripe/middleware.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +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 assign to your application's routes.

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`:
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;

protected $routeMiddleware = [
protected $middlewareAliases = [
// ...

'subscribed' => VerifyBillableIsSubscribed::class
];
```

Once the middleware has been registered, you may attach it 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'])
Expand Down