-
-
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
Showing
3 changed files
with
110 additions
and
1 deletion.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -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 ----------- | ||
|
@@ -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(); | ||
|
@@ -80,6 +89,7 @@ function(\Illuminate\Mail\Message $message) use($data){ | |
->subject($data['subject']); | ||
} | ||
); | ||
*/ | ||
//*/ | ||
|
||
|
||
|
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,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; | ||
} | ||
|
||
} |
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,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 [ | ||
// | ||
]; | ||
} | ||
} |