1. Go to this page and download the library: Download sashalenz/dinstar-api library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
use Illuminate\Notifications\Notification;
use Sashalenz\DinstarApi\Notifications\DinstarSmsChannel;
use Sashalenz\DinstarApi\Notifications\DinstarSmsMessage;
class OrderShipped extends Notification
{
public function via(object $notifiable): array
{
return [DinstarSmsChannel::class]; // or 'dinstar-sms'
}
public function toDinstarSms(object $notifiable): DinstarSmsMessage
{
return DinstarSmsMessage::create('Your order has shipped!')
->ports([1, 2]) // optional
->withoutDeliveryReport() // optional
->userId($this->order->id); // optional
}
}
public function toDinstarSms(object $notifiable): string
{
return 'Your code is 12345';
}
class User extends Authenticatable
{
use Notifiable;
public function routeNotificationForDinstarSms($notification)
{
return $this->phone;
}
}