1. Go to this page and download the library: Download surpaimb/laravel-jpush 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/ */
use Illuminate\Foundation\Auth\User as Authenticatable;
use Surpaimb\JPush\Sender as JPushSender;
class User extends Authenticatable
{
/**
* Get Notification for JPush sender.
* @return \Surpaimb\JPush\Sender
*/
protected function routeNotificationForJpush()
{
return new JPushSender([
'platform' => 'all',
'audience' => [
'alias' => sprintf('user_%d', $this->id),
],
]);
}
}