thinkstudeo /
textlocal-notification-channel
| 1 | <?php |
||||||
| 2 | |||||||
| 3 | namespace NotificationChannels\Textlocal; |
||||||
| 4 | |||||||
| 5 | use Illuminate\Notifications\Notification; |
||||||
| 6 | |||||||
| 7 | class TextlocalChannel |
||||||
| 8 | { |
||||||
| 9 | public function __construct(TextlocalClient $client) |
||||||
| 10 | { |
||||||
| 11 | $this->textlocal = $client; |
||||||
|
0 ignored issues
–
show
Bug
Best Practice
introduced
by
Loading history...
|
|||||||
| 12 | } |
||||||
| 13 | |||||||
| 14 | /** |
||||||
| 15 | * Send the given notification. |
||||||
| 16 | * |
||||||
| 17 | * @param mixed $notifiable |
||||||
| 18 | * @param \Illuminate\Notifications\Notification $notification |
||||||
| 19 | * |
||||||
| 20 | * @throws \NotificationChannels\Textlocal\Exceptions\CouldNotSendNotification |
||||||
| 21 | */ |
||||||
| 22 | public function send($notifiable, Notification $notification) |
||||||
| 23 | { |
||||||
| 24 | if (! $to = $notifiable->routeNotificationFor('textlocal')) { |
||||||
| 25 | return; |
||||||
| 26 | } |
||||||
| 27 | |||||||
| 28 | $message = $notification->toTextlocal($notifiable); |
||||||
|
0 ignored issues
–
show
The method
toTextlocal() does not exist on Illuminate\Notifications\Notification. It seems like you code against a sub-type of said class. However, the method does not exist in Illuminate\Auth\Notifications\ResetPassword or Illuminate\Auth\Notifications\VerifyEmail. Are you sure you never get one of those?
(
Ignorable by Annotation
)
If this is a false-positive, you can also ignore this issue in your code via the
Loading history...
|
|||||||
| 29 | |||||||
| 30 | if (is_string($message)) { |
||||||
| 31 | $message = new TextlocalMessage($message); |
||||||
| 32 | } |
||||||
| 33 | |||||||
| 34 | return $this->textlocal->message($to, $message); |
||||||
| 35 | } |
||||||
| 36 | } |
||||||
| 37 |