PHP code example of curly-deni / laravel-notifications

1. Go to this page and download the library: Download curly-deni/laravel-notifications 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/ */

    

curly-deni / laravel-notifications example snippets


return [
    'user_model' => App\Models\User::class,
    'database' => [
        'table' => 'notifications',
    ],
];

use Aesis\Notifications\Traits\HasNotifications;

class User extends Authenticatable
{
    use HasNotifications;
}

use Aesis\Notifications\Services\UserNotificationService;

$notification = app(UserNotificationService::class)->createForUser(
    $user,
    [
        'type' => 'order.paid',
        'title' => 'Payment received',
        'message' => 'Your order has been paid.',
        'level' => 'success',
        'href' => '/orders/123',
    ],
    dedupeKey: 'order.paid:123',
);
bash
php artisan vendor:publish --tag=laravel-notifications-config
php artisan vendor:publish --tag=laravel-notifications-migrations
php artisan migrate