Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
marco76tv authored and Malebestia committed Sep 4, 2023
1 parent b1e5efa commit c703d6d
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 1 deletion.
12 changes: 11 additions & 1 deletion Models/Panels/Actions/TrySendMailAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@

use Illuminate\Support\Facades\Mail;
use Modules\Notify\Emails\BeautyEmail;
use Modules\Notify\Notifications\Notify;
use Modules\Theme\Services\ThemeService;
use Illuminate\Support\Facades\Notification;
use Modules\Notify\Notifications\TestNotification;
use Modules\Xot\Models\Panels\Actions\XotBasePanelAction;

// -------- bases -----------
Expand Down Expand Up @@ -66,7 +69,13 @@ public function postHandle() {
*/
//$view='notify::emails.welcome';
$view='notify::emails.samples.ark';

$test=(object)['a'=>'b'];
$users=[
new Notify('mail','[email protected]'),
];

Notification::send($users, new TestNotification($test));
/*
$beautymail = app()->make(BeautyEmail::class);
$view_params=$beautymail->getSettings();
Expand All @@ -80,6 +89,7 @@ function(\Illuminate\Mail\Message $message) use($data){
->subject($data['subject']);
}
);
*/
//*/


Expand Down
36 changes: 36 additions & 0 deletions Notifications/Notify.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

declare(strict_types=1);

namespace Modules\Notify\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Messages\MailMessage;
use Illuminate\Notifications\Notification;

class Notify {

/**
* All of the notification routing information.
*
* @var array
*/
public $routes = [];

public function __construct($channel, $route){
$this->routes[$channel] = $route;

}


/** Get the notification routing information for the given driver.
*
* @param string $driver
* @return mixed
*/
public function routeNotificationFor($driver)
{
return $this->routes[$driver] ?? null;
}

}
63 changes: 63 additions & 0 deletions Notifications/TestNotification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

namespace Modules\Notify\Notifications;

use Illuminate\Bus\Queueable;
use Illuminate\Notifications\Notification;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Notifications\Messages\MailMessage;

class TestNotification extends Notification {
use Queueable;

/**
* Create a new notification instance.
*
* @return void
*/
public function __construct($a){
//dddx($a); //
// TestNotification($test)
//
}

/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable
* @return array
*/
public function via($notifiable){
dddx($notifiable->routes);
//

return ['mail'];
}

/**
* Get the mail representation of the notification.
*
* @param mixed $notifiable
* @return \Illuminate\Notifications\Messages\MailMessage
*/
public function toMail($notifiable){
//dddx($notifiable);
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($notifiable);
return [
//
];
}
}

0 comments on commit c703d6d

Please sign in to comment.