1. Go to this page and download the library: Download saurabhpunia/notifyx 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/ */
saurabhpunia / notifyx example snippets
// Send a simple notification
notify($user)
->title('Welcome!')
->with('Thanks for joining our platform')
->type('message')
->send();
namespace App\Models;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Notifyx\Concerns\HasNotifyx;
class User extends Authenticatable
{
use HasNotifyx; // Add this line
// ... rest of your User model
}
// Get recent notifications
$notifications = $user->getNotifications(10);
// Get paginated notifications
$notifications = $user->getPaginatedNotifications(15);
// Get unread count
$unreadCount = $user->getUnreadCount();
// Mark notification as read
$user->markNotificationAsRead($notificationId);
// Mark all as read
$user->markAllNotificationsAsRead();
// Check if user has enabled email notifications for billing
if ($user->hasEnabledNotification('billing', 'mail')) {
// Send billing notification via email
}