• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

daem0ndev/laravel-spark: Fork of laravel/spark at 140ed52

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

daem0ndev/laravel-spark

开源软件地址(OpenSource Url):

https://github.com/daem0ndev/laravel-spark

开源编程语言(OpenSource Language):

PHP 76.9%

开源软件介绍(OpenSource Introduction):

Spark

Introduction

This is an alpha, experimental release of Spark. Things will change. Things will break. Thank you for testing!

Spark is an experimental project primarily intended for building business oriented SaaS applications, and is highly opinionated towards that use case.

Installation

First, install the Spark installer and make sure that the global Composer bin directory is within your system's $PATH:

	composer global require "laravel/spark-installer=~1.0"

Next, create a new Laravel application and install Spark:

	laravel new application

	cd application

	spark install

After installing Spark, be sure to migrate your database, install the NPM dependencies, and run the gulp command. You should also set the AUTHY_KEY, STRIPE_KEY, and STRIPE_SECRET environment variables in your .env file.

You may also wish to review the SparkServiceProvider class that was installed in your application. This provider is the central location for customizing your Spark installation.

Defining Subscription Plans

Subscription plans may be defined in your app/Providers/SparkServiceProvider.php file. This file contains a customizeSubscriptionPlans method. Within this method, you may define all of your application's subscription plans. There are a few examples in the method to get you started.

When defining a Spark plan, the plan method accepts two arguments: the name of the plan and the Stripe ID of the plan. Be sure that the Stripe ID given to the plan method corresponds to a plan ID on your Stripe account:

	Spark::plan('Display Name', 'stripe-id')
		->price(10)
		->features([
			//
		]);

Yearly Plans

To define a yearly plan, simply call the yearly method on the plan definition:

	Spark::plan('Basic', 'basic-yearly')
		->price(100)
		->yearly()
		->features(
			//
		);

Coupons

To use a coupon, simply create the coupon on Stripe and access the /register route with a coupon query string variable that matches the ID of the coupon on Stripe.

    http://stripe.app/register?coupon=code

Site-wide promotions may be run using the Spark::promotion method within your SparkServiceProvider:

	Spark::promotion('coupon-code');

Teams

To enable teams, simply use the CanJoinTeams trait on your User model. The trait has already been imported in the top of the file, so you only need to add it to the model itself:

	class User extends Model implements TwoFactorAuthenticatableContract,
	                                    BillableContract,
	                                    CanResetPasswordContract
	{
	    use Billable, CanJoinTeams, CanResetPassword, TwoFactorAuthenticatable;
	}

Once teams are enabled, a team name will be required during registration, and a Teams tab will be available in the user settings dashboard.

Roles

Team roles may be defined in the customizeRoles method of the SparkServiceProvider.

Customizing Spark Views

You may publish Spark's common Blade views by using the vendor:publish command:

	php artisan vendor:publish --tag=spark-basics

All published views will be placed in resources/views/vendor/spark.

If you would like to publish every Spark view, you may use the spark-full tag:

	php artisan vendor:publish --tag=spark-full

Customizing Spark JavaScript

The resources/assets/js/core/components.js file contains the statements to load some common Spark Vue components. Vue is the JavaScript framework used by the Spark registration and settings screens.

You are free to change any of these require statements to load your own Vue component for a given screen. Most likely, you will want to copy the original component as a starting point for your customization.




鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
cecoo/laravel4demo: laravel4demo发布时间:2022-07-09
下一篇:
jeroennoten/Laravel-Prerender: Laravel middleware for prerendering javascript-re ...发布时间:2022-07-09
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap