XetaIO /
Xetaravel
| 1 | <?php |
||
| 2 | |||
| 3 | declare(strict_types=1); |
||
| 4 | |||
| 5 | namespace Xetaravel\Notifications; |
||
| 6 | |||
| 7 | use Illuminate\Bus\Queueable; |
||
| 8 | use Illuminate\Contracts\Queue\ShouldQueue; |
||
| 9 | use Illuminate\Notifications\Notification; |
||
| 10 | use Xetaravel\Models\Badge; |
||
| 11 | use Xetaravel\Models\User; |
||
| 12 | |||
| 13 | class BadgeNotification extends Notification implements ShouldQueue |
||
| 14 | { |
||
| 15 | use Queueable; |
||
| 16 | |||
| 17 | /** |
||
| 18 | * The badge instance. |
||
| 19 | * |
||
| 20 | * @var Badge |
||
| 21 | */ |
||
| 22 | public Badge $badge; |
||
| 23 | |||
| 24 | /** |
||
| 25 | * Create a new notification instance. |
||
| 26 | * |
||
| 27 | * @param Badge $badge |
||
| 28 | */ |
||
| 29 | public function __construct(Badge $badge) |
||
| 30 | { |
||
| 31 | $this->badge = $badge; |
||
| 32 | } |
||
| 33 | |||
| 34 | /** |
||
| 35 | * Get the notification's delivery channels. |
||
| 36 | * |
||
| 37 | * @param User $notifiable |
||
| 38 | * |
||
| 39 | * @return array |
||
| 40 | */ |
||
| 41 | public function via(User $notifiable): array |
||
|
0 ignored issues
–
show
|
|||
| 42 | { |
||
| 43 | return ['database']; |
||
| 44 | } |
||
| 45 | |||
| 46 | /** |
||
| 47 | * Get the array representation of the notification. |
||
| 48 | * |
||
| 49 | * @param User $notifiable |
||
| 50 | * |
||
| 51 | * @return array |
||
| 52 | */ |
||
| 53 | public function toDatabase(User $notifiable): array |
||
| 54 | { |
||
| 55 | return [ |
||
| 56 | 'message' => "You have unlocked the badge <strong>{$this->badge->name}</strong> !", |
||
| 57 | 'icon' => $this->badge->icon, |
||
| 58 | 'color' => $this->badge->color, |
||
| 59 | 'type' => 'badge', |
||
| 60 | 'link' => $notifiable->show_url |
||
|
0 ignored issues
–
show
|
|||
| 61 | ]; |
||
| 62 | } |
||
| 63 | } |
||
| 64 |
This check looks for parameters that have been defined for a function or method, but which are not used in the method body.