1. Go to this page and download the library: Download piscibus/notifly 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/ */
namespace App;
use Illuminate\Foundation\Auth\User as Authenticatable;
use Piscibus\Notifly\Contracts\TransformableInterface;
use Piscibus\Notifly\Traits\Notifiable;
class User extends Authenticatable implements TransformableInterface
{
use Notifiable;
}
use App\Notifications\CommentNotification;
$user->notify(new CommentNotification($actor, $object, $target));
use Illuminate\Database\Eloquent\Model;
use Piscibus\Notifly\Contracts\TransformableInterface;
use Piscibus\Notifly\Traits\Notifly;
class Comment extends Model implements TransformableInterface
{
use Notifly;
}
use Piscibus\Notifly\Notifications\Notification;
class CommentNotification extends Notification
{
/**
* @var string
*/
protected $verb = 'comment';
}
namespace App\Icons;
use Piscibus\Notifly\Notifications\Icon;
class CommentNotificationIcon extends Icon
{
/**
* Get notification icon attributes
*
* @return array
*/
public function toArray(): array
{
return [
'width' => 0,
'height' => 0,
'uri' => null,
];
}
}
namespace App;
use Illuminate\Database\Eloquent\Model;
use Piscibus\Notifly\Contracts\TransformableInterface;
use Piscibus\Notifly\Traits\Notifiable;
use App\Http\Resources\Comment as CommentResource;
class Comment extends Model implements TransformableInterface
{
use Notifiable;
/**
* Gets the Eloquent API Resource
**/
public function getTransformer(): JsonResource
{
return new CommentResource($this);
}
}