jawabapp/cloud-messaging 问题修复 & 功能扩展

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

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

jawabapp/cloud-messaging

Composer 安装命令:

composer require jawabapp/cloud-messaging

包简介

README 文档

README

Installation

You can install the package via composer:

composer require jawabapp/cloud-messaging

Usage

User.php Model
use Jawabapp\CloudMessaging\Contracts\TargetAudience;
use Jawabapp\CloudMessaging\Traits\EloquentGetTableNameTrait;
use Jawabapp\CloudMessaging\Traits\HasTargetAudience;

class User extends Authenticatable implements TargetAudience
{
	use HasTargetAudience;
	use EloquentGetTableNameTrait;
	//...
}

implement those methods from TargetAudience interface.

use Illuminate\Database\Eloquent\Builder;

class User extends Authenticatable implements TargetAudience
{
	public static function targetAudienceForPhoneNumbers(Builder $query, $phone_numbers)
    {
        //...
    }

	public static function targetAudienceForOS(Builder $query, $os)
    {
        //...
    }
}
Adding more filters
User.php Model
public static function targetAudienceForCountries(Builder $query, $condition, $options, &$joins)
    {
        if ($condition === 'is_not_in') {
            $query->whereNotIn('phone_country', $options);
        } else {
            $query->whereIn('phone_country', $options);
        }
    }
cloud-messaging.php config file
'filter_types' => [
	[
            'value' => 'countries',
            'label' => 'Country/Region',
            'selectLabel' => 'Countries',
            'conditions' => [
                [
                    'value' => 'is_in',
                    'label' => 'Is in',
                ],
                [
                    'value' => 'is_not_in',
                    'label' => 'Is not in',
                ]
            ]
	],
	//...
]
web.php web route file
Route::group(['prefix' => env('JAWAB_CLOUD_MESSAGING_PATH', 'jawab-notifications')], function () {
    Route::group(['prefix' => 'api'], function () {
        Route::get('countries', 'Api\Admin\CountryController@index');
        //...
    });
});
CountryController.php web route file
public function index(Request $request)
{

    $mobile_os = $request->get('os');

    return User::select(['phone_country_code'])
        ->distinct()
        ->whereNotNull('phone_country_code')
        ->where('os', $mobile_os)
        ->get()
        ->map(function ($item) {
            return [
                'value' => $item->phone_country_code,
                'text' => $item->phone_country_code,
            ];
        });
}
change notifilable model
cloud-messaging.php config file
[
	'notifiable_model' => \App\Models\User::class,
]

Changelog

Please see CHANGELOG for more information what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security

If you discover any security related issues, please email trmdy@hotmail.com instead of using the issue tracker.

Credits

License

The MIT License (MIT). Please see License File for more information.

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2021-07-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固