// config/mobilyws
// Authentication mode
'authentication' => 'auto',
// Set yor login credentials to communicate with mobily.ws Api
'mobile' => env('MOBILY_WS_MOBILE'),
'password' => env('MOBILY_WS_PASSWORD'),
// Or use the generated apiKey from your mobily.ws account
'apiKey' => env('MOBILY_WS_API_KEY'),
// Name of Sender must be approved by mobily.ws
'sender' => env('MOBILY_WS_SENDER'),
namespace App\Notifications;
use Illuminate\Notifications\Notification;
use NotificationChannels\MobilyWs\MobilyWsChannel;
use NotificationChannels\MobilyWs\MobilyWsMessage;
class UserRegistered extends Notification
{
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable)
{
return [MobilyWsChannel::class];
}
/**
* Get the text message representation of the notification
*
* @param mixed $notifiable
* @param \NotificationChannels\MobilyWs\MobilyWsMessage $msg
*
* @return \NotificationChannels\MobilyWs\MobilyWsMessage|string
*/
public function toMobilyWs($notifiable, MobilyWsMessage $msg)
{
return "Dear $notifiable->name, welcome to our website";
}
}
namespace App;
use Illuminate\Notifications\Notifiable;
use Illuminate\Foundation\Auth\User as Authenticatable;
class User extends Authenticatable
{
use Notifiable;
/**
* Route notifications for the MobilyWs channel.
*
* @return string
*/
public function routeNotificationForMobilyWs()
{
return $this->mobile;
}
}
use App\Notifications\UserRegistered;
$user = App\User::first();
$user->notify(new UserRegistered());
public function toMobilyWs($notifiable)
{
return (new MobilyWsMessage)
->text("Message text")
->time(Carbon::parse("+1 week);
}
use NotificationChannels\MobilyWs\MobilyWsMessage;
//
/**
* Get the text message of the SMS.
*
* @param mixed $notifiable
* @return \NotificationChannels\MobilyWs\MobilyWsMessage|string
*/
public function toMobilyWs($notifiable)
{
return MobilyWsMessage::create("Text message");
}
public function toMobilyWs($notifiable, MobilyWsMessage $msg)
{
return $msg->text($this->message);
}