Build a Monthly Subscription App with Laravel Cashier

Subscribed Middleware

We're already using the built-in auth middleware that Laravel provides. We are going to create our own to make sure only subscribed users can get to certain sections of our site.

To create a middleware, run the following from the command line:

# will be created at app/Http/Middleware/Subscribed.php
php artisan make:middleware subscribed

To use this middleware, it needs to be brought into app/Http/Kernel.php.

protected $routeMiddleware = [
    ...other middleware
    'subscribed' => \App\Http\Middleware\Subscribed::class

Like this article? Follow @chrisoncode on Twitter