Sh3ll
OdayForums


Server : Apache
System : Linux 145.162.205.92.host.secureserver.net 5.14.0-611.45.1.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Wed Apr 1 05:56:53 EDT 2026 x86_64
User : tradze ( 1001)
PHP Version : 8.1.34
Disable Function : NONE
Directory :  /home/tradze/.trash/app_old/Modules/Users/Http/Controllers/Api/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Current File : /home/tradze/.trash/app_old/Modules/Users/Http/Controllers/Api/ApiNotifications.php
<?php
namespace App\Modules\Users\Http\Controllers\Api;


use App\User;
use App\Http\Controllers\Controller;
use UrbanAirship\Airship;
use UrbanAirship\AirshipException;
use UrbanAirship\UALog;
use UrbanAirship\Push as P;
use Monolog\Logger;
use Monolog\Handler\StreamHandler;


class ApiNotifications extends Controller
{

    /**
     * Test notification system
     */
    public function send_test(User $user)
    {
        $sendTo = [];
        $devices = $user->devices->where('os','iOS');
        foreach($devices as $device)
            $sendTo[]=$device->push_token;


        $airship = new Airship("nTQIdXYvTmaZE-FhBWbn8A", "Kj7uEeWcTB2K5nA_MkuVng");

        try {
//            $response = $airship->push()
//                ->setAudience(P\all)
//                ->setNotification(P\notification("Hello from php"))
//                ->setDeviceTypes(P\all)
//                ->send();

            $response = $airship->push()
                ->setAudience("6aac8ad0-2d9e-4037-94c0-f5e48351f305")
                ->setNotification(P\notification("Hello from PHP"))
                ->setDeviceTypes(P\all)
                ->send();

            dd($response);
        } catch (AirshipException $e) {
            print_r($e);
        }


    }

}

ZeroDay Forums Mini