netcore/module-subscription 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

netcore/module-subscription

Composer 安装命令:

composer require netcore/module-subscription

包简介

README 文档

README

This module allows you to manage subscription plans and let users to subscribe to plans.

Pre-installation

Only use this module if you are using a fully custom payment method. If you use Laravel Cashier, there's support coming for that!

This package is part of Netcore CMS ecosystem and is only functional in a project that has the following packages installed:

  1. https://github.com/netcore/netcore
  2. https://github.com/netcore/module-admin
  3. https://github.com/netcore/module-translate

Installation

  • Require this package using composer
composer require netcore/module-subscription
  • Publish configuration/migrations
php artisan module:publish-config Subscription
php artisan module:publish-migration Subscription
php artisan migrate
  • Configure plans and billing periods in config/netcore/module-subscription.php file.

  • Seed the configuration to database

php artisan module:seed Subscription
  • Add Modules\Subscription\Traits\Subscribable trait to your User model

Usage

  • Subscribe to a plan with price specification
$plan      = Modules\Subscription\Models\Plan::where('key', 'premium')->first();
$planPrice = $plan->prices()->inPeriod('monthly')->first();
$user      = App\User::first();
$user->subscribe($planPrice, true);
/*
 The boolean stands for whether the user has already paid for the subscription or not.
 If a boolean is not provided, it'll be automatically set to false.
*/
  • Get user plan
$plan = $user->plan;
  • Get user subscription
$subscription   = $user->subscription;
$expirationDate = $subscription->expires_at;
$userHasPaid    = $subscription->is_paid;
  • Cancel subscription
$user->cancelSubscription();
  • Renew subscription
$user->renewSubscription(true);
// The boolean stands for whether the user has already paid for the subscription or not

统计信息

  • 总下载量: 153
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 1
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 4
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: Unknown
  • 更新时间: 2017-11-24

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固