class YourController extends Controller
{
public function __construct(PushManager $pushManager)
{
$this->pushManager = $pushManager;
}
class YourController extends Controller
{
public function sendPushNotification()
{
$pushManager = app('PushManager'); // this will keep the PushManager instance singleton
}
namespace App\Http\Controllers;
use Illuminate\Routing\Controller;
use PushManager;
class Controller extends Controller
{
public function __construct(PushManager $pushManager)
{
$this->pushManager = $pushManager;
}
public function sendPushNotification()
{
$response = $this->pushManager
->setTitle('Test Title')
->setBody('Test Body')
->setIcon('icon url')
->setClickAction('https://www.google.com')
->setCustomPayload(['custom_data' => 'custom_data_array'])
->setPriority(PushNotification::HIGH)
->setContentAvailable(true)
->setDeviceTokens('--------------------') // this can be an array or string
->push();
dd( $response );
}
}
->push(PushManager::STDCLASS)
$this->pushManager->getLastErrorCode() //if no error then 0
$this->pushManager->getLastErrorMessage() // if no error then ""
json
php artisan vendor:publish --tag="config"
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.