Originally posted by **jansgescheit** April 18, 2022
Hey,
it would be nice to have a Notification Channel for Zammad.
e.g.
```php
[...]
class CustomerRequest extends Notification
{
use Queueable;
/**
* Get the notification channels.
*
*/
public function via($notifiable)
{
return [
ZammadChannel::class,
OtherChannel::class,
];
}
/**
* Get the zammad representation of the notification.
*/
public function toZammad($notifiable)
{
return (new Zammad::ticketBuilder()->title([...])...
}
}
```
```php
[...]
class ZammadChannel
{
/**
* Send the given notification.
*/
public function send($notifiable, Notification $notification)
{
$message = $notification->toZammad($notifiable);
(new Zammad())->user()->searchOrCreateByEmail($message->customer)
return (new Zammad())->ticket()->create($message->body());
}
}
```
Discussed in https://github.com/codebar-ag/laravel-zammad/discussions/7