for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
declare(strict_types=1);
namespace Xetaravel\Notifications;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Notification;
use Xetaravel\Models\Badge;
use Xetaravel\Models\User;
class BadgeNotification extends Notification implements ShouldQueue
{
use Queueable;
/**
* The badge instance.
*
* @var Badge
*/
public Badge $badge;
* Create a new notification instance.
* @param Badge $badge
public function __construct(Badge $badge)
$this->badge = $badge;
}
* Get the notification's delivery channels.
* @param User $notifiable
* @return array
public function via(User $notifiable): array
$notifiable
If this is a false-positive, you can also ignore this issue in your code via the ignore-unused annotation
ignore-unused
public function via(/** @scrutinizer ignore-unused */ User $notifiable): array
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.
return ['database'];
* Get the array representation of the notification.
public function toDatabase(User $notifiable): array
return [
'message' => "You have unlocked the badge <strong>{$this->badge->name}</strong> !",
'icon' => $this->badge->icon,
'color' => $this->badge->color,
'type' => 'badge',
'link' => $notifiable->show_url
show_url
Xetaravel\Models\User
];
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.