-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Malebestia
committed
Sep 4, 2023
1 parent
9f3a48b
commit 7713866
Showing
10 changed files
with
288 additions
and
3 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
Database/Migrations/2022_10_12_133532_create_notifications_table.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
<?php | ||
/** | ||
* --. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Modules\Notify\Models\Panels\Actions; | ||
|
||
// -------- services -------- | ||
|
||
use Exception; | ||
use ErrorException; | ||
use Illuminate\Support\Facades\Mail; | ||
use Modules\UI\Services\ThemeService; | ||
use Modules\Notify\Emails\BeautyEmail; | ||
use Modules\Notify\Notifications\Notify; | ||
use Illuminate\Support\Facades\Notification; | ||
use Modules\Notify\Notifications\HtmlNotification; | ||
use Modules\Notify\Notifications\TestNotification; | ||
use Modules\Cms\Models\Panels\Actions\XotBasePanelAction; | ||
|
||
// -------- bases ----------- | ||
|
||
/** | ||
* Class TrySendNotificationAction. | ||
*/ | ||
class TrySendNotificationAction extends XotBasePanelAction { | ||
public bool $onItem = true; | ||
public string $icon = '<i class="fas fa-vial"></i>TrySendNotification'; | ||
|
||
/** | ||
* @return mixed | ||
*/ | ||
public function handle() { | ||
|
||
Notification::route('mail', [ | ||
'[email protected]' => 'Davide Cavallini', | ||
])->notify(new HtmlNotification('[email protected]','Soggetto a caso','<h1>Ciao</h1>')); | ||
|
||
return 'done'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
<?php | ||
|
||
namespace Modules\Notify\Notifications; | ||
|
||
use Illuminate\Bus\Queueable; | ||
use Illuminate\Notifications\Notification; | ||
use Illuminate\Contracts\Queue\ShouldQueue; | ||
use Illuminate\Notifications\Messages\MailMessage; | ||
use Modules\Notify\Data\SmsData; | ||
|
||
use Modules\Notify\Notifications\Channels\EsendexChannel; | ||
|
||
class SampleNotification extends Notification | ||
{ | ||
use Queueable; | ||
|
||
/** | ||
* Create a new notification instance. | ||
* | ||
* @return void | ||
*/ | ||
public function __construct(array $data) | ||
{ | ||
// | ||
$this->data=$data; | ||
} | ||
|
||
/** | ||
* Get the notification's delivery channels. | ||
* | ||
* @param mixed $notifiable | ||
* @return array | ||
*/ | ||
public function via($notifiable):array | ||
{ | ||
$channels = []; | ||
$channels[]=EsendexChannel::class; | ||
//$channels[]='esendex'; //Driver [esendex] not supported. | ||
//$channels[]='database'; | ||
return $channels; | ||
} | ||
|
||
/** | ||
* Get the mail representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return \Illuminate\Notifications\Messages\MailMessage | ||
*/ | ||
public function toEssendex($notifiable){ | ||
dddx($notifiable); | ||
} | ||
|
||
|
||
public function toSms($notifiable){ | ||
|
||
$res= SmsData::from([ | ||
'from' => $this->data['from'], | ||
//'to' => $notifiable->routeNotificationFor('sms'), | ||
'to' => $this->data['to'], | ||
'body' => $this->data['body'], | ||
]); | ||
dddx($res); | ||
return $res; | ||
} | ||
|
||
|
||
/** | ||
* Get the mail representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return \Illuminate\Notifications\Messages\MailMessage | ||
*/ | ||
public function toMail($notifiable) | ||
{ | ||
dddx('oo'); | ||
return (new MailMessage) | ||
->line('The introduction to the notification.') | ||
->action('Notification Action', 'https://laravel.com') | ||
->line('Thank you for using our application!'); | ||
} | ||
|
||
/** | ||
* Get the array representation of the notification. | ||
* | ||
* @param mixed $notifiable | ||
* @return array | ||
*/ | ||
public function toArray($notifiable) | ||
{ | ||
dddx('oo'); | ||
return [ | ||
// | ||
]; | ||
} | ||
} |
Oops, something went wrong.