1. Go to this page and download the library: Download al-one/laravel-xiaomi-push library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
namespace App;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Notifications\Notifiable;
class User extends Model
{
use Notifiable;
/**
* 小米推送路由
*/
public function routeNotificationForXiaomiPush()
{
// return $this->xiaomi_push_regid;
return $this->getKey();
}
/**
* 如果不同用户所属的APP包名可能不同,请添加此方法
*/
public function getAppPackage()
{
return 'com.app.bundle_id';
}
/**
* 添加此方法以判断用户是否为苹果设备用户
*/
public function isIosDevice()
{
return true;
}
}