keithbrink/affiliates-spark
Composer 安装命令:
composer require keithbrink/affiliates-spark
包简介
An affiliates package for Laravel Spark that allows you to track referrals from affiliates and pay commission
README 文档
README
An affiliates package for Laravel Spark that allows you to track referrals from affiliates and pay commission.
Installation
Cashier 10+ / Laravel 6+ is supported in the 1.* releases. To use older versions, use one of the 0.* releases.
To get the latest version, simply require the project using Composer:
$ composer require keithbrink/affiliates-spark
Configuration
- In your User model, add the Affiliate trait:
use KeithBrink\AffiliatesSpark\Traits\Affiliate as AffiliateTrait; class User extends SparkUser { use AffiliateTrait; ... }
- In your SparkServiceProvider, add the following functions to handle adding affiliate IDs to the database:
Spark::createUsersWith('KeithBrink\AffiliatesSpark\Interactions\SaveAffiliateOnRegistration@createUser'); Spark::createTeamsWith('KeithBrink\AffiliatesSpark\Interactions\SaveAffiliateOnRegistration@createTeam');
or, if you want to add extra data to your user registration, use the interaction directly:
use KeithBrink\AffiliatesSpark\Interactions\SaveAffiliateOnRegistration; ... Spark::createUsersWith(function ($request) { $extra_data = [ ... ]; $interaction = new SaveAffiliateOnRegistration; return $interaction->createUser($request, $extra_data); });
- Add a link for affiliates in the menu dropdown. Edit
\resources\views\vendor\spark\nav\user.blade.php, and under the Developer menu item (line 65), add the following code:
@if (Auth::user()->isAffiliate()) @include('affiliates-spark::nav.affiliate-menu-item') @endif
- Add a link for managing affiliates in the Kiosk menu. Edit your
\resources\views\vendor\spark\kiosk.blade.php, and under the Metrics Link item (line 30), add the following code:
<!-- Affiliates Link --> @include('affiliates-spark::nav.affiliate-menu-item-kiosk')
and in the same file under Tab Cards, add the following code:
<!-- Affiliates Tab --> @include('affiliates-spark::nav.affiliate-tab-item-kiosk')
- Publish the package javascript with the command:
php artisan vendor:publish --provider="KeithBrink\AffiliatesSpark\AffiliatesSparkServiceProvider" --tag=javascript. Then, in your/resources/js/app.js, require the package javascript:
require('./affiliates-spark/bootstrap');
Remember to compile the assets with npm run dev.
-
Publish the package views with the command:
php artisan vendor:publish --provider="KeithBrink\AffiliatesSpark\AffiliatesSparkServiceProvider" --tag=views. You should enter instructions for your affiliates in/resources/views/vendor/affiliates-spark/affiliates/instructions.blade.php. -
Run the package migrations with the command:
php artisan migrate --package "keithbrink/affiliates-spark.
Optional Configuration
- If you would like your customers to see the discount they are receiving from an affiliate on the subcription page, in your
resources/views/vendor/spark/settings/subscription/subscription-notice.blade.phpfile, after the@elsestatement (line 9), add:
@include('affiliates-spark::subscription.affiliate-discount')
Usage
- On any page that you would like to credit affiliates for sending people to, add the script:
<script async="" src="/a-s/aff.js"></script>. You can also add the script to a different subdomain of the same top-level domain by making the src URL absolute rather than relative.
License
SegmentSpark is licensed under The MIT License (MIT).
keithbrink/affiliates-spark 适用场景与选型建议
keithbrink/affiliates-spark 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 200 次下载、GitHub Stars 达 24, 最近一次更新时间为 2019 年 01 月 16 日, 在 PHP 生态内属于活跃度较高的组件。
我们在过去多个企业项目中使用过 keithbrink/affiliates-spark 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 keithbrink/affiliates-spark 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
统计信息
- 总下载量: 200
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 24
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2019-01-16