This module is part of TypiCMS, a multilingual CMS based on the Laravel framework.
It allows you to setup a subscriptions management system based on Laravel Cashier for Mollie.
- You must have a working installation of TypiCMS
- Make sure your
APP_URLin.envis correctly set.
composer require typicms/subscriptions// config/app.php
/*
* TypiCMS Modules Service Providers.
* Here is the place for your modules,
* they should be set before Core Service provider.
*/
…
TypiCMS\Modules\Subscriptions\Providers\ModuleServiceProvider::class,
…Add the cashier model and the mollie key in your .env environment file:
CASHIER_MODEL=TypiCMS\Modules\Core\Models\User
MOLLIE_KEY="test_12345678912345678912345678912345"php artisan typicms:publish UsersModify the User model like this:
…
use TypiCMS\Modules\Subscriptions\Traits\BillableUser;
…
class User extends Model implements …
{
…
use BillableUser;
…
}More information can be found here
If needed, allow the following fields to be fillable.
protected $fillable = [
'tax_percentage',
'mollie_customer_id',
'mollie_mandate_id',
'tax_percentage',
'trial_ends_at',
'extra_billing_information'
];Install Cashier and migrate the database.
php artisan subscriptions:installEdit resources/scss/public.scss and add:
@import 'public/account';
@import 'public/plan-list';Run npm run dev to compile the public.css file.
Configure your subscription plans in config/cashier_plans.php.
Manage any coupons in config/cashier_coupons.php. By default an example coupon is enabled, consider disabling it before deploying to production.
Create a page linked to the Subscriptions module and navigate to it.
Quickly build an effective pricing table for your potential customers with the template created under /plans and linked to the PublicController@plans controller.
Copy the Cashier package views using the following command:
php artisan vendor:publish --provider="Laravel\Cashier\CashierServiceProvider" --tag="cashier-views"You can customize the /resources/views/vendor/cashier/ files as you like.
To specify the tax percentage a user pays on a subscription, edit the tax_percentage column for the user in the database.
The displayed price on the subscription has built-in tax calculation.
