In this section, I will cover making a place for an admin user to come in and see reports about members. This will need some seed data, as I will attempt to show the membership statuses in one place.
We will aim for something as follows:
If you have not followed this far, then you will need at least a base Laravel installed with the cashier and auth setups.
Set up a route for the admin dashboard:
Make a controller for the route:
>php artisan make:controller AdminMembershipsDashboardController
Let's protect the
app/Http/Controllers/AdminMembershipsDashboardController.php
controller:Now, we need to add middleware to check whether this user is an admin. I already added
is_admin
as a boolean field on the users table; see Chapter 5, Working with Data; we also created middleware using Chapter 7, Authentication, Security and Subscriptions to protect the user admin area, so we know this is protected.Seed some users with subscriptions...