PHP code example of a-mazalov / a1-notification-channel
1. Go to this page and download the library: Download a-mazalov/a1-notification-channel 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/ */
a-mazalov / a1-notification-channel example snippets
php
namespace App\Notifications;
use A1\Channel\A1Message;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;
class TestNotification extends Notification
{
use Queueable;
public $message;
public function __construct($message)
{
$this->message = $message;
}
public function via($notifiable)
{
return ['a1'];
}
// ..
public function toA1($notifiable)
{
return (new A1Message)
->content($this->message);
}
}
php
// App\Models\v1\Employee
// Так же необходимо добавить трейт для уведомлений
use Notifiable;
public function routeNotificationForA1()
{
return $this->mtel ? '375' . $this->mtel : null;
}
php
$user->notify(new Notification())
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.