Skip to content

Commit

Permalink
inject Filament Notifications to the driver abstract
Browse files Browse the repository at this point in the history
  • Loading branch information
3x1io committed Nov 25, 2024
1 parent 9b13c44 commit 64dd746
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/Services/Drivers/DatabaseDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function sendIt(
?string $action = 'system',
?array $data = [],
?int $template_id = null,
?Notification $notification = null
): void {
if ($modelId) {
dispatch(new NotifyDatabaseJob([
Expand Down
7 changes: 5 additions & 2 deletions src/Services/Drivers/Driver.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace TomatoPHP\FilamentAlerts\Services\Drivers;

use Filament\Notifications\Notification;
use TomatoPHP\FilamentAlerts\Facades\FilamentAlerts;

abstract class Driver
Expand All @@ -19,7 +20,8 @@ abstract public function sendIt(
?string $type = 'info',
?string $action = 'system',
?array $data = [],
?int $template_id = null
?int $template_id = null,
?Notification $notification = null
): void;

public function send(
Expand All @@ -28,7 +30,8 @@ public function send(
int | string | null $modelId = null,
array $title = [],
array $body = [],
array $data = []
array $data = [],
?Notification $notification = null
): void {
$loadTemplate = FilamentAlerts::loadTemplate(
$template,
Expand Down
1 change: 1 addition & 0 deletions src/Services/Drivers/EmailDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public function sendIt(
?string $action = 'system',
?array $data = [],
?int $template_id = null,
?Notification $notification = null
): void {
if ($modelId) {
$email = $model::find($modelId)?->email;
Expand Down

0 comments on commit 64dd746

Please sign in to comment.