1. Go to this page and download the library: Download tashkar18/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/ */
use Tashkar18\Notification\NotificationInterface;
use Tashkar18\Notification\NotificationTrait;
class Comment extends Eloquent implements NotificationInterface
{
use NotificationTrait;
/**
* This determines the recipient id of the event.
* For example, if a user comments on a post, the recipient of the
* notification would be the post's author.
* @return {int}
*/
public function getNotificationRecipient()
{
return $this->post->user_id;
}
/**
* This determines the sender id of the event.
* For example, if a user comments on a post, the sender of the
* notification would be the comment's author. (This will typically
* be user_id, but you might also use a different attribute for the user_id like author_id);
* @return {int}
*/
public function getNotificationSender()
{
return $this->user_id;
}
use Tashkar18\Notification\NoterTrait;
class User extends Eloquent implements UserInterface, RemindableInterface {
use UserTrait, RemindableTrait, NoterTrait;
return $user->notifications;
return array(
'view' => 'notifications'
);
// views/notifications/comment.blade.php
{{{ ucfirst($comment->user->username) }}} commented on your post.