Skip to content

Commit

Permalink
up
Browse files Browse the repository at this point in the history
  • Loading branch information
marco76tv committed Jun 24, 2024
1 parent b5c8045 commit fc4b09a
Show file tree
Hide file tree
Showing 10 changed files with 126 additions and 112 deletions.
13 changes: 11 additions & 2 deletions Datas/SmtpData.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,23 @@
class SmtpData extends Data
{
public string $transport = 'smtp';

public ?string $url = null;

public string $host = '127.0.0.1';

public int $port = 2525;

public ?string $encryption = null; // 'tls';

public ?bool $tls = null;

public ?string $username = null;

public ?string $password = null;

public ?string $timeout = null;

public ?string $local_domain = null;

private static array $instance = [];
Expand All @@ -38,11 +47,11 @@ public static function make(string $name = 'smtp'): self
public function getTransport(): EsmtpTransport
{
$transport = new EsmtpTransport($this->host, $this->port, $this->tls);
if (null !== $this->username && null !== $this->password) {
if ($this->username !== null && $this->password !== null) {
$transport->setUsername($this->username);
$transport->setPassword($this->password);
}

return $transport;
}
}
}
5 changes: 2 additions & 3 deletions Filament/Clusters/Test/Pages/SendPushNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,10 @@
use Modules\Notify\Filament\Clusters\Test;
use Modules\User\Models\DeviceUser;
use Modules\Xot\Filament\Traits\NavigationLabelTrait;
use Webmozart\Assert\Assert;

use function Safe\json_encode;

use Webmozart\Assert\Assert;

/**
* @property ComponentContainer $notificationForm
*/
Expand Down Expand Up @@ -68,7 +67,7 @@ public function notificationForm(Form $form): Form
* ---.
*/
$filterCallback = function ($item) {
return null != $item->profile;
return $item->profile != null;
};

$to = $devices
Expand Down
2 changes: 1 addition & 1 deletion Filament/Clusters/Test/Pages/SendTelegram.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public function sendEmail(): void
*/
// Notification::sendNow($developers, new TelegramNotification());
Notification::route('telegram', $data['to'])
->notify(new TelegramNotification());
->notify(new TelegramNotification);
}

protected function getForms(): array
Expand Down
50 changes: 25 additions & 25 deletions Filament/Clusters/Test/Pages/TestSmtpPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,30 +103,30 @@ public function emailForm(Form $form): Form
])->columns(3),
Section::make('MAIL')
// ->description('Update your account\'s profile information and email address.')
->schema(
[
Forms\Components\TextInput::make('email_from_address')
// ->unique(ignoreRecord: true)
->default(env('MAIL_FROM_ADDRESS', $email))
->email()
->required(),
Forms\Components\TextInput::make('email_from_name')
// ->unique(ignoreRecord: true)
->default(env('MAIL_FROM_NAME')),
Forms\Components\TextInput::make('email_to')
// ->unique(ignoreRecord: true)
->default($email)
->email()
->required(),
Forms\Components\TextInput::make('subject')
->default('test')
->required(),
Forms\Components\RichEditor::make('body')
->default('test body')
->required()
->columnSpanFull(),
]
)->columns(3),
->schema(
[
Forms\Components\TextInput::make('email_from_address')
// ->unique(ignoreRecord: true)
->default(env('MAIL_FROM_ADDRESS', $email))
->email()
->required(),
Forms\Components\TextInput::make('email_from_name')
// ->unique(ignoreRecord: true)
->default(env('MAIL_FROM_NAME')),
Forms\Components\TextInput::make('email_to')
// ->unique(ignoreRecord: true)
->default($email)
->email()
->required(),
Forms\Components\TextInput::make('subject')
->default('test')
->required(),
Forms\Components\RichEditor::make('body')
->default('test body')
->required()
->columnSpanFull(),
]
)->columns(3),
]
)
->statePath('emailData');
Expand Down Expand Up @@ -159,7 +159,7 @@ public function sendEmail(): void
$from = new Address($email_from_address, $email_from_name);

$mailer = new Mailer($transport);
$email = (new Email())
$email = (new Email)
->from($from)
->to($email_to)
->subject($email_data->subject)
Expand Down
64 changes: 32 additions & 32 deletions Models/Contact.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
/**
* Modules\Notify\Models\Contact.
*
* @property int $id
* @property string $model_type
* @property string $model_id
* @property int $id
* @property string $model_type
* @property string $model_id
* @property string|null $contact_type
* @property string|null $value
* @property string|null $user_id
Expand All @@ -23,9 +23,9 @@
* @property string|null $created_by
* @property string|null $token
* @property string|null $sms_sent_at
* @property int|null $sms_count
* @property int|null $sms_count
* @property string|null $mail_sent_at
* @property int|null $mail_count
* @property int|null $mail_count
* @property string|null $survey_pdf_id
* @property string|null $token
* @property string|null $first_name
Expand All @@ -47,35 +47,35 @@
* @property string|null $usesleft
* @property string|null $sms_status_code
* @property string|null $sms_status_txt
* @property int|null $duplicate_count
* @property int|null $order_column
* @property int|null $duplicate_count
* @property int|null $order_column
*
* @method static \Modules\Notify\Database\Factories\ContactFactory factory($count = null, $state = [])
* @method static Builder|Contact newModelQuery()
* @method static Builder|Contact newQuery()
* @method static Builder|Contact query()
* @method static Builder|Contact whereContactType($value)
* @method static Builder|Contact whereCreatedAt($value)
* @method static Builder|Contact whereCreatedBy($value)
* @method static Builder|Contact whereId($value)
* @method static Builder|Contact whereModelId($value)
* @method static Builder|Contact whereModelType($value)
* @method static Builder|Contact whereLastName($value)
* @method static Builder|Contact whereMailCount($value)
* @method static Builder|Contact whereMailSentAt($value)
* @method static Builder|Contact whereMobilePhone($value)
* @method static Builder|Contact whereOrderColumn($value)
* @method static Builder|Contact whereSmsCount($value)
* @method static Builder|Contact whereSmsSentAt($value)
* @method static Builder|Contact whereSmsStatusCode($value)
* @method static Builder|Contact whereSmsStatusTxt($value)
* @method static Builder|Contact whereSurveyPdfId($value)
* @method static Builder|Contact whereToken($value)
* @method static Builder|Contact whereUpdatedAt($value)
* @method static Builder|Contact whereUpdatedBy($value)
* @method static Builder|Contact whereUserId($value)
* @method static Builder|Contact whereValue($value)
* @method static Builder|Contact whereVerifiedAt($value)
* @method static Builder|Contact newModelQuery()
* @method static Builder|Contact newQuery()
* @method static Builder|Contact query()
* @method static Builder|Contact whereContactType($value)
* @method static Builder|Contact whereCreatedAt($value)
* @method static Builder|Contact whereCreatedBy($value)
* @method static Builder|Contact whereId($value)
* @method static Builder|Contact whereModelId($value)
* @method static Builder|Contact whereModelType($value)
* @method static Builder|Contact whereLastName($value)
* @method static Builder|Contact whereMailCount($value)
* @method static Builder|Contact whereMailSentAt($value)
* @method static Builder|Contact whereMobilePhone($value)
* @method static Builder|Contact whereOrderColumn($value)
* @method static Builder|Contact whereSmsCount($value)
* @method static Builder|Contact whereSmsSentAt($value)
* @method static Builder|Contact whereSmsStatusCode($value)
* @method static Builder|Contact whereSmsStatusTxt($value)
* @method static Builder|Contact whereSurveyPdfId($value)
* @method static Builder|Contact whereToken($value)
* @method static Builder|Contact whereUpdatedAt($value)
* @method static Builder|Contact whereUpdatedBy($value)
* @method static Builder|Contact whereUserId($value)
* @method static Builder|Contact whereValue($value)
* @method static Builder|Contact whereVerifiedAt($value)
*
* @mixin Eloquent
*
Expand Down
4 changes: 4 additions & 0 deletions Models/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
* @property Carbon|null $updated_at
* @property string|null $updated_by
* @property Model|\Eloquent $notifiable
*
* @method static DatabaseNotificationCollection<int, static> all($columns = ['*'])
* @method static DatabaseNotificationCollection<int, static> get($columns = ['*'])
* @method static \Illuminate\Database\Eloquent\Builder|Notification newModelQuery()
Expand All @@ -42,7 +43,9 @@
* @method static \Illuminate\Database\Eloquent\Builder|Notification whereUpdatedBy($value)
* @method static DatabaseNotificationCollection<int, static> all($columns = ['*'])
* @method static DatabaseNotificationCollection<int, static> get($columns = ['*'])
*
* @mixin Eloquent
*
* @method static DatabaseNotificationCollection<int, static> all($columns = ['*'])
* @method static DatabaseNotificationCollection<int, static> get($columns = ['*'])
* @method static DatabaseNotificationCollection<int, static> all($columns = ['*'])
Expand Down Expand Up @@ -83,6 +86,7 @@
* @method static DatabaseNotificationCollection<int, static> get($columns = ['*'])
* @method static DatabaseNotificationCollection<int, static> all($columns = ['*'])
* @method static DatabaseNotificationCollection<int, static> get($columns = ['*'])
*
* @mixin \Eloquent
*/
class Notification extends DatabaseNotification
Expand Down
88 changes: 44 additions & 44 deletions Models/NotifyTheme.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,53 +15,53 @@
/**
* Modules\Notify\Models\NotifyTheme.
*
* @property int $id
* @property string|null $lang
* @property string|null $type
* @property string|null $subject
* @property string|null $body
* @property string|null $from
* @property Carbon|null $created_at
* @property string|null $created_by
* @property Carbon|null $updated_at
* @property string|null $updated_by
* @property string|null $post_type
* @property int|null $post_id
* @property string|null $body_html
* @property string|null $theme
* @property string|null $from_email
* @property string|null $logo_src
* @property int|null $logo_width
* @property int|null $logo_height
* @property array $view_params
* @property array $logo
* @property Model|\Eloquent $linkable
* @property int $id
* @property string|null $lang
* @property string|null $type
* @property string|null $subject
* @property string|null $body
* @property string|null $from
* @property Carbon|null $created_at
* @property string|null $created_by
* @property Carbon|null $updated_at
* @property string|null $updated_by
* @property string|null $post_type
* @property int|null $post_id
* @property string|null $body_html
* @property string|null $theme
* @property string|null $from_email
* @property string|null $logo_src
* @property int|null $logo_width
* @property int|null $logo_height
* @property array $view_params
* @property array $logo
* @property Model|\Eloquent $linkable
* @property MediaCollection<int, \Modules\Media\Models\Media> $media
* @property int|null $media_count
* @property int|null $media_count
*
* @method static \Modules\Notify\Database\Factories\NotifyThemeFactory factory($count = null, $state = [])
* @method static Builder|NotifyTheme newModelQuery()
* @method static Builder|NotifyTheme newQuery()
* @method static Builder|NotifyTheme query()
* @method static Builder|NotifyTheme whereBody($value)
* @method static Builder|NotifyTheme whereBodyHtml($value)
* @method static Builder|NotifyTheme whereCreatedAt($value)
* @method static Builder|NotifyTheme whereCreatedBy($value)
* @method static Builder|NotifyTheme whereFrom($value)
* @method static Builder|NotifyTheme whereFromEmail($value)
* @method static Builder|NotifyTheme whereId($value)
* @method static Builder|NotifyTheme whereLang($value)
* @method static Builder|NotifyTheme whereLogoHeight($value)
* @method static Builder|NotifyTheme whereLogoSrc($value)
* @method static Builder|NotifyTheme whereLogoWidth($value)
* @method static Builder|NotifyTheme wherePostId($value)
* @method static Builder|NotifyTheme wherePostType($value)
* @method static Builder|NotifyTheme whereSubject($value)
* @method static Builder|NotifyTheme whereTheme($value)
* @method static Builder|NotifyTheme whereType($value)
* @method static Builder|NotifyTheme whereUpdatedAt($value)
* @method static Builder|NotifyTheme whereUpdatedBy($value)
* @method static Builder|NotifyTheme whereViewParams($value)
* @method static Builder|NotifyTheme newModelQuery()
* @method static Builder|NotifyTheme newQuery()
* @method static Builder|NotifyTheme query()
* @method static Builder|NotifyTheme whereBody($value)
* @method static Builder|NotifyTheme whereBodyHtml($value)
* @method static Builder|NotifyTheme whereCreatedAt($value)
* @method static Builder|NotifyTheme whereCreatedBy($value)
* @method static Builder|NotifyTheme whereFrom($value)
* @method static Builder|NotifyTheme whereFromEmail($value)
* @method static Builder|NotifyTheme whereId($value)
* @method static Builder|NotifyTheme whereLang($value)
* @method static Builder|NotifyTheme whereLogoHeight($value)
* @method static Builder|NotifyTheme whereLogoSrc($value)
* @method static Builder|NotifyTheme whereLogoWidth($value)
* @method static Builder|NotifyTheme wherePostId($value)
* @method static Builder|NotifyTheme wherePostType($value)
* @method static Builder|NotifyTheme whereSubject($value)
* @method static Builder|NotifyTheme whereTheme($value)
* @method static Builder|NotifyTheme whereType($value)
* @method static Builder|NotifyTheme whereUpdatedAt($value)
* @method static Builder|NotifyTheme whereUpdatedBy($value)
* @method static Builder|NotifyTheme whereViewParams($value)
*
* @mixin Eloquent
* @mixin \Eloquent
Expand Down
2 changes: 2 additions & 0 deletions Models/NotifyThemeable.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @property Carbon|null $updated_at
* @property string|null $updated_by
* @property int|null $notify_theme_id
*
* @method static Builder|NotifyThemeable newModelQuery()
* @method static Builder|NotifyThemeable newQuery()
* @method static Builder|NotifyThemeable query()
Expand All @@ -29,6 +30,7 @@
* @method static Builder|NotifyThemeable whereNotifyThemeId($value)
* @method static Builder|NotifyThemeable whereUpdatedAt($value)
* @method static Builder|NotifyThemeable whereUpdatedBy($value)
*
* @mixin Eloquent
* @mixin \Eloquent
*/
Expand Down
1 change: 1 addition & 0 deletions Notifications/Channels/NetfunChannel.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Modules\Notify\Actions\NetfunSendAction;
use Modules\Notify\Contracts\CanThemeNotificationContract;
use Modules\Notify\Notifications\ThemeNotification;

// use Modules\Xot\Contracts\ModelContactContract;

class NetfunChannel
Expand Down
9 changes: 4 additions & 5 deletions Notifications/TelegramNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public function __construct()
/**
* Get the notification's delivery channels.
*
* @param mixed $notifiable the entity to be notified
* @param mixed $notifiable the entity to be notified
*
* @throws \InvalidArgumentException if no delivery channels are available for the notifiable entity
*/
Expand Down Expand Up @@ -66,9 +66,8 @@ public function toTelegram(?object $notifiable): TelegramMessage

// (Optional) Inline Buttons
->button('View Invoice', $url)
->button('Download Invoice', $url)
// (Optional) Inline Button with callback. You can handle callback in your bot instance
// ->buttonWithCallback('Confirm', 'confirm_invoice '.$this->invoice->id)
;
->button('Download Invoice', $url);
// (Optional) Inline Button with callback. You can handle callback in your bot instance
// ->buttonWithCallback('Confirm', 'confirm_invoice '.$this->invoice->id)
}
}

0 comments on commit fc4b09a

Please sign in to comment.