PHP code example of godforhire / databasenotifications

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

    

godforhire / databasenotifications example snippets


use godforhire\DatabaseNotifications\DatabaseChannel;
use godforhire\DatabaseNotifications\DatabaseMessage;
use Illuminate\Notifications\Notification;

class BackupHasFailed extends Notification
{
    public function via($notifiable)
    {
        return [DatabaseChannel::class];
    }

    public function toDatabase($notifiable)
    {
        return DatabaseMessage::create()
                    ->user(1)
                    ->data([
                        'event' => 'Backup failed',
                    	'description' => 'Daily backup of Your App has failed: reason, disk S3 is unreachable.',
                    	'...' => '...'
                    ]);
    }
}