承接 mydnic/laravel-subscribers 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

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

mydnic/laravel-subscribers

最新稳定版本:v1.9.1

Composer 安装命令:

composer require mydnic/laravel-subscribers

包简介

Easily Manage Internal Newsletter Subscribers in Laravel

README 文档

README

Latest Version on Packagist Software License Build Status Code Quality

Installation

You may use Composer to Install Laravel Subscribers:

composer require mydnic/laravel-subscribers

The package will automatically register itself

You then must publish the migration with:

php artisan vendor:publish --provider="Mydnic\Subscribers\SubscribersServiceProvider" --tag="subscribers-migrations"

Usage

In your view, you simply need to add a form that you can customize the way you want

<form action="{{ route('subscribers.store') }}" method="post">
    @csrf
    <input type="email" name="email">
    <input type="submit" value="submit">
</form>

@if (session('subscribed'))
    <div class="alert alert-success">
        {{ session('subscribed') }}
    </div>
@endif

Delete

Simply provide this link to your subscribers:

<a href="{{ route('subscribers.delete', ['email' => $subscriber->email]) }}">unsubscribe</a>

This will generate a link like /subscribers/delete?email=email@example.com

Subscribe manually from the user model

Alternatively, you can manage the subscription of a user from the user model.

In order to do that you will need to add the CanSubscribe trait

use Mydnic\Subscribers\Traits\CanSubscribe;

class User extends Model
{
    use CanSubscribe;
}
// subscribe user
$user->subscribe();

// unsubscribe user
$user->unsubscribe();

统计信息

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

GitHub 信息

  • Stars: 26
  • Watchers: 1
  • Forks: 5
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2019-01-25