PHP code example of c4studio / notification
1. Go to this page and download the library: Download c4studio/notification 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/ */
c4studio / notification example snippets
C4studio\Notification\NotificationServiceProvider::class,
'Notification' => C4studio\Notification\Facades\Notification::class,
class User extends Model
{
use HasNotifications;
...
}
Notification::notify('Notification message', Auth::user());
Notification::notify('Notification message', \App\User::all());
Notification::notify('Notification message');
notify('Message', Auth::user());
notify('Message');
Auth::user()->notifications;
Auth::user()->notifications()->first();
Auth::user()->notifications_system;
Auth::user()->notifications_system()->first();
$notification::markRead();
$notification::markRead(\App\User::first());
$notification::markUnread(1);
echo $notification::read ? 'It is read' : 'It is not read';
$notification::recipients;
$notification::recipients->take(2)->get();
Notification::query()->orderBy('timestamp', 'desc')->take(2)->get();
app/config/app.php