PHP code example of montopolis / mynabird

1. Go to this page and download the library: Download montopolis/mynabird 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/ */

    

montopolis / mynabird example snippets



// in config/mynabird.php
return [
    'should_broadcast' => false,
];



declare(strict_types=1);

namespace App\Console;

use Montopolis\Mynabird\DataObjects\Alert;
use Montopolis\Mynabird\Interfaces\AlertsRepository;

class BroadcastAlert extends Command
{
    protected $signature = 'app:broadcast-alert';
    protected $description = 'Send an alert to all users.';

    protected $alertsRepository;

    public function __construct(AlertsRepository $alertsRepository)
    {
        parent::__construct();
        $this->alertsRepository = $alertsRepository;
    }

    public function handle()
    {
        // Create an alert object: Montopolis\Mynabird\DataObjects\Alert
        $alert = new Alert(
            null,
            $title,
            $body,
            $url,
            $level,
            null, // set to user ID for individual notification
            true // set to `true` for broadcast message
        );

        // Send the alert:
        $this->alertsRepository->store($alert);
    }
}
bash
php artisan vendor:publish --provider="Montopolis\Mynabird\MynabirdServiceProvider"
php artisan migrate
bash
php artisan nova:publish
html
// in file: resources/views/vendor/nova/layout.blade.php

  ...

  <dropdown class="ml-auto h-9 flex items-center dropdown-right">
      @indow.Nova = new CreateNova(config)
    </script>

    <!-- Alerts -->
    @