diff --git a/resources/views/forms/components/iframe.blade.php b/resources/views/forms/components/iframe.blade.php index b724398..abe023a 100644 --- a/resources/views/forms/components/iframe.blade.php +++ b/resources/views/forms/components/iframe.blade.php @@ -1,7 +1,7 @@ diff --git a/src/Components/Iframe.php b/src/Components/Iframe.php index 096a90a..051d87f 100644 --- a/src/Components/Iframe.php +++ b/src/Components/Iframe.php @@ -8,12 +8,12 @@ class Iframe extends Component { protected string $view = 'vb-email-templates::forms.components.iframe'; - public $name; - public $src; - public $height; - public $width; + public string $name; + public string $src; + public string $height; + public string $width; - public function __construct($name, $label = null, $src = null, $height = '800px', $width = '100%') + public function __construct($name, $src = null, $height = '800px', $width = '100%') { $this->src = $src; $this->height = $height; @@ -24,13 +24,19 @@ public function __construct($name, $label = null, $src = null, $height = '800px' protected function setUp(): void { - $this->afterStateHydrated(function ($record) { - $this->src = route('email-template.preview', $record); - }); + parent::setUp(); + } - public static function make($name, $label = null, $src = null, $height = '800px', $width = '100%') + // protected function setUp(): void + // { + // $this->afterStateHydrated(function ($record) { + // $this->src = route('email-template.preview', $record); + // }); + // } + + public static function make($name, $src = null, $height = '800px', $width = '100%') { - return new static($name, $label, $src, $height, $width); + return new static($name, $src, $height, $width); } } diff --git a/src/Contracts/FormHelperInterface.php b/src/Contracts/FormHelperInterface.php new file mode 100644 index 0000000..058d3c0 --- /dev/null +++ b/src/Contracts/FormHelperInterface.php @@ -0,0 +1,12 @@ + 'https://cdn.jsdelivr.net/gh/lipis/flag-icons@6.6.6/css/flag-icons.min.css', - // ]; - public function configurePackage(Package $package): void { $package->name("filament-email-templates") @@ -40,35 +33,16 @@ public function configurePackage(Package $package): void ]); } - // public function register() - // { - // parent::register(); - // $this->app->singleton(TokenHelperInterface::class, TokenHelper::class); - // $this->app->singleton(CreateMailableInterface::class, CreateMailableHelper::class); - // $this->app->register(EmailTemplatesEventServiceProvider::class); - // } - public function packageRegistered(): void { parent::packageRegistered(); $this->app->singleton(TokenHelperInterface::class, TokenHelper::class); $this->app->singleton(CreateMailableInterface::class, CreateMailableHelper::class); + $this->app->singleton(FormHelperInterface::class, FormHelper::class); $this->app->register(EmailTemplatesEventServiceProvider::class); } - // public function boot() - // { - // parent::boot(); - // if($this->app->runningInConsole()) { - // $this->publishResources(); - // } - - // $this->registerRoutes(); - - // $this->loadTranslationsFrom(__DIR__.'/../resources/lang', 'vb-email-templates'); - // } - public function packageBooted(): void { parent::packageBooted(); diff --git a/src/Helpers/FormHelper.php b/src/Helpers/FormHelper.php new file mode 100644 index 0000000..cab05c6 --- /dev/null +++ b/src/Helpers/FormHelper.php @@ -0,0 +1,93 @@ +mapWithKeys(function ($langVal, $langKey) { + return [ + $langKey => ' '.$langVal["display"], + ]; + })->toArray(); + } + + public function getTemplateViewOptions() + { + $overrideDirectory = resource_path('views/vendor/vb-email-templates/email'); + $packageDirectory = dirname(view(config('email-templates.template_view_path').'.default')->getPath()); + + $directories = [$overrideDirectory, $packageDirectory]; + + $filenamesArray = collect($directories) + ->filter(function ($directory) { + return file_exists($directory); + }) + ->flatMap(function ($directory) { + return self::getFiles($directory, $directory); + }) + ->unique() + ->values() + ->toArray(); + + return array_combine($filenamesArray, $filenamesArray); + } + + /** + * Recursively get all files in a directory and children + */ + private static function getFiles($dir, $basepath) + { + $files = $subdirs = $subFiles = []; + + if ($handle = opendir($dir)) { + while (false !== ($entry = readdir($handle))) { + if ($entry == "." || $entry == "..") { + continue; + } + if (substr($entry, 0, 1) == '_') { + continue; + } + $entryPath = $dir.'/'.$entry; + if (is_dir($entryPath)) { + $subdirs[] = $entryPath; + } else { + $subFiles[] = str_replace( + '/', + '.', + str_replace( + '.blade.php', + '', + str_replace( + $basepath.'/', + '', + $entryPath + ) + ) + ); + } + } + closedir($handle); + sort($subFiles); + $files = array_merge($files, $subFiles); + foreach ($subdirs as $subdir) { + $files = array_merge($files, self::getFiles($subdir, $basepath)); + } + } + + return $files; + } + + public function getRecipientOptions() + { + return collect(config('email-templates.recipients'))->mapWithKeys(function ($recipient) { + $splitNamespace = explode('\\', $recipient); + $className = end($splitNamespace); // Get the class name without namespace + + return [$className => $recipient]; // Use class name as key and full class name as value + })->toArray(); + } +} diff --git a/src/Listeners/PasswordResetListener.php b/src/Listeners/PasswordResetListener.php index 51b2c2b..3e76a09 100644 --- a/src/Listeners/PasswordResetListener.php +++ b/src/Listeners/PasswordResetListener.php @@ -4,7 +4,7 @@ use Illuminate\Auth\Events\PasswordReset; -use Visualbuilder\EmailTemplates\Notifications\UserVerifiedNotification; +use Visualbuilder\EmailTemplates\Notifications\UserPasswordResetNotification; class PasswordResetListener { @@ -27,7 +27,7 @@ public function __construct() public function handle(PasswordReset $event) { $user = $event->user; - $user->notify(new UserVerifiedNotification()); + $user->notify(new UserPasswordResetNotification()); } diff --git a/src/Listeners/UserLockoutListener.php b/src/Listeners/UserLockoutListener.php index 5ac08cb..6d679f9 100644 --- a/src/Listeners/UserLockoutListener.php +++ b/src/Listeners/UserLockoutListener.php @@ -3,6 +3,7 @@ namespace Visualbuilder\EmailTemplates\Listeners; use Illuminate\Auth\Events\Login; +use Visualbuilder\EmailTemplates\Notifications\UserLockoutNotification; class UserLockoutListener { @@ -15,7 +16,7 @@ class UserLockoutListener public function handle(Login $event) { $user = $event->user; - $user->notify(new UserLoNotification()); + $user->notify(new UserLockoutNotification()); } } diff --git a/src/Listeners/UserRegisteredListener.php b/src/Listeners/UserRegisteredListener.php index 9b11e98..b7caf7e 100644 --- a/src/Listeners/UserRegisteredListener.php +++ b/src/Listeners/UserRegisteredListener.php @@ -3,7 +3,7 @@ namespace Visualbuilder\EmailTemplates\Listeners; use Illuminate\Auth\Events\Registered; -use Visualbuilder\EmailTemplates\Notifications\UserLoginNotification; +use Visualbuilder\EmailTemplates\Notifications\UserRegisteredNotification; class UserRegisteredListener { @@ -17,7 +17,7 @@ public function handle(Registered $event) { if(config('email-templates.send_emails.new_user_registered')) { $user = $event->user; - $user->notify(new UserLoginNotification()); + $user->notify(new UserRegisteredNotification()); } diff --git a/src/Models/EmailTemplate.php b/src/Models/EmailTemplate.php index 9483616..21b6d1f 100644 --- a/src/Models/EmailTemplate.php +++ b/src/Models/EmailTemplate.php @@ -129,4 +129,9 @@ public function viewPath(): Attribute get: fn () => config('email-templates.template_view_path').'.'.$this->view ); } + + public function previewUrl() + { + return route('email-template.preview', $this); + } } diff --git a/src/Notifications/UserVerifiedNotification.php b/src/Notifications/UserVerifiedNotification.php index b451670..1e38f33 100644 --- a/src/Notifications/UserVerifiedNotification.php +++ b/src/Notifications/UserVerifiedNotification.php @@ -28,7 +28,7 @@ public function __construct() */ public function via($notifiable) { - return array_merge($this->userVias($notifiable), ['telegram']); + return ['mail']; } /** diff --git a/src/Resources/EmailTemplateResource.php b/src/Resources/EmailTemplateResource.php index aef0f26..7035c30 100644 --- a/src/Resources/EmailTemplateResource.php +++ b/src/Resources/EmailTemplateResource.php @@ -18,6 +18,8 @@ use Illuminate\Database\Eloquent\Builder; use Illuminate\Database\Eloquent\SoftDeletingScope; use Illuminate\Support\Str; +use Visualbuilder\EmailTemplates\Contracts\CreateMailableInterface; +use Visualbuilder\EmailTemplates\Contracts\FormHelperInterface; use Visualbuilder\EmailTemplates\Models\EmailTemplate; use Visualbuilder\EmailTemplates\Resources\EmailTemplateResource\Pages; @@ -38,9 +40,11 @@ public static function getPluralModelLabel(): string public static function form(Form $form): Form { - $languages = self::prepareLang(); - $templates = self::getTemplateViewList(); - $recipients = self::getRecipients(); + $mailHelper = app(CreateMailableInterface::class); + $formHelper = app(FormHelperInterface::class); + $templates = $formHelper->getTemplateViewOptions(); + $recipients = $formHelper->getRecipientOptions(); + return $form->schema( [ @@ -70,7 +74,7 @@ public static function form(Form $form): Form ->required() ->unique(ignorable: fn ($record) => $record), Select::make('language') - ->options($languages) + ->options($formHelper->getLanguageOptions()) ->default(config('email-templates.default_locale')) ->searchable() ->allowHtml(), @@ -119,91 +123,6 @@ public static function form(Form $form): Form ); } - public static function prepareLang() - { - return collect(config('email-templates.languages'))->mapWithKeys(function ($langVal, $langKey) { - return [ - $langKey => ' '.$langVal["display"], - ]; - })->toArray(); - } - - public static function getTemplateViewList() - { - $overrideDirectory = resource_path('views/vendor/vb-email-templates/email'); - $packageDirectory = dirname(view(config('email-templates.template_view_path').'.default')->getPath()); - - $directories = [$overrideDirectory, $packageDirectory]; - - $filenamesArray = collect($directories) - ->filter(function ($directory) { - return file_exists($directory); - }) - ->flatMap(function ($directory) { - return self::getFiles($directory, $directory); - }) - ->unique() - ->values() - ->toArray(); - - return array_combine($filenamesArray, $filenamesArray); - } - - /** - * Recursively get all files in a directory and children - */ - private static function getFiles($dir, $basepath) - { - $files = $subdirs = $subFiles = []; - - if ($handle = opendir($dir)) { - while (false !== ($entry = readdir($handle))) { - if ($entry == "." || $entry == "..") { - continue; - } - if (substr($entry, 0, 1) == '_') { - continue; - } - $entryPath = $dir.'/'.$entry; - if (is_dir($entryPath)) { - $subdirs[] = $entryPath; - } else { - $subFiles[] = str_replace( - '/', - '.', - str_replace( - '.blade.php', - '', - str_replace( - $basepath.'/', - '', - $entryPath - ) - ) - ); - } - } - closedir($handle); - sort($subFiles); - $files = array_merge($files, $subFiles); - foreach ($subdirs as $subdir) { - $files = array_merge($files, self::getFiles($subdir, $basepath)); - } - } - - return $files; - } - - public static function getRecipients() - { - return collect(config('email-templates.recipients'))->mapWithKeys(function ($recipient) { - $splitNamespace = explode('\\', $recipient); - $className = end($splitNamespace); // Get the class name without namespace - - return [$className => $recipient]; // Use class name as key and full class name as value - })->toArray(); - } - public static function table(Table $table): Table { return $table->columns( @@ -231,8 +150,7 @@ public static function table(Table $table): Table ->icon('heroicon-o-document-text') // ->action('createMailClass'), ->action(function ($record) { - $createMailableHelper = app(\Visualbuilder\EmailTemplates\Contracts\CreateMailableInterface::class); - $notify = $createMailableHelper->createMailable($record); + $notify = $this->mailHelper->createMailable($record); // dd($record); Notification::make() ->title($notify->title) diff --git a/src/Resources/EmailTemplateResource/Pages/PreviewEmailTemplate.php b/src/Resources/EmailTemplateResource/Pages/PreviewEmailTemplate.php index 5021477..2b6bf2b 100644 --- a/src/Resources/EmailTemplateResource/Pages/PreviewEmailTemplate.php +++ b/src/Resources/EmailTemplateResource/Pages/PreviewEmailTemplate.php @@ -8,6 +8,7 @@ use Filament\Forms\Components\TextInput; +use Filament\Forms\Components\View; use Filament\Forms\Form; use Filament\Resources\Pages\ViewRecord; use Visualbuilder\EmailTemplates\Components\Iframe; @@ -32,81 +33,66 @@ public function getTitle(): string public function __construct() { - // parent::__construct(); $this->tokenHelper = app(\Visualbuilder\EmailTemplates\Contracts\TokenHelperInterface::class); } - // protected function getForms(): array - // { - // return [ - // 'form' => $this->makeForm() - // ->operation('view') - // ->model($this->getRecord()) - // ->schema($this->getFormSchema()) - // ->statePath('data') - // ->inlineLabel(config('filament.layout.forms.have_inline_labels')), - // ]; - // } - public function form(Form $form): Form { - //View Email Template Form - $emailTemplates = EmailTemplate::all()->pluck('name', 'id'); - return static::getResource()::form( - $form - ->operation('view') + + return $form + //->operation('view') // ->disabled() ->model($this->getRecord()) ->statePath($this->getFormStatePath()) ->columns($this->hasInlineLabels() ? 1 : 2) ->inlineLabel($this->hasInlineLabels()) - // ->schema( - // [ - // Section::make() - // ->schema( - // [ - // Grid::make(['default' => 1, 'sm' => 1, 'md' => 2]) - // ->schema( - // [ - // Select::make('id') - // ->options($emailTemplates) - // ->searchable() - // ->label(__('vb-email-templates::email-templates.general-labels.template-name')) - // ->reactive() - // ->afterStateUpdated(function ($state) { - // $this->redirectRoute('filament.resources.email-templates.view', $state); - // }), - - // TextInput::make('from') - // ->label(__('vb-email-templates::email-templates.form-fields-labels.email-from')) - // ->disabled(), - // ] - // ), - // Grid::make(['default' => 1]) - // ->schema( - // [ - // TextInput::make('subject') - // ->label(__('vb-email-templates::email-templates.form-fields-labels.subject')) - // ->disabled(), - // TextInput::make('preheader') - // ->label(__('vb-email-templates::email-templates.form-fields-labels.header')) - // ->hint(__('vb-email-templates::email-templates.form-fields-labels.header-hint')) - // ->disabled(), - // ] - // ), - // Grid::make(['default' => 1]) - // ->schema( - // [ - // Iframe::make('iframe'), - // ] - // ), - - // ] - // ), - // ] - // ) - ); + ->schema( + [ + Section::make() + ->schema( + [ + Grid::make(['default' => 1, 'sm' => 1, 'md' => 2]) + ->schema( + [ + Select::make('id') + ->options(EmailTemplate::all()->pluck('name', 'id')) + ->searchable() + ->label(__('vb-email-templates::email-templates.general-labels.template-name')) + ->reactive() + ->afterStateUpdated(function ($state) { + $this->redirectRoute('filament.resources.email-templates.view', $state); + }), + + TextInput::make('from') + ->label(__('vb-email-templates::email-templates.form-fields-labels.email-from')) + ->disabled(), + ] + ), + Grid::make(['default' => 1]) + ->schema( + [ + TextInput::make('subject') + ->label(__('vb-email-templates::email-templates.form-fields-labels.subject')) + ->disabled(), + TextInput::make('preheader') + ->label(__('vb-email-templates::email-templates.form-fields-labels.header')) + ->hint(__('vb-email-templates::email-templates.form-fields-labels.header-hint')) + ->disabled(), + ] + ), + Grid::make(['default' => 1]) + ->schema( + [ + Iframe::make('preview', route('email-template.preview', $this->getRecord())), + ] + ), + + ] + ), + ] + ); + } public function getFormStatePath(): ?string diff --git a/src/Stubs/EmailTemplateResource.stub b/src/Stubs/EmailTemplateResource.stub index 087d326..60a1906 100644 --- a/src/Stubs/EmailTemplateResource.stub +++ b/src/Stubs/EmailTemplateResource.stub @@ -1,6 +1,6 @@ getTemplateViewOptions(); + $recipients = $formHelper->getRecipientOptions(); + return $form->schema( [ @@ -50,15 +56,10 @@ class EmailTemplateResource extends Resource ->schema( [ TextInput::make('name') - ->reactive() - ->afterStateUpdated( - function (Set $set, $state) { - $set('key', Str::slug($state)); - } - ) - ->label(__('vb-email-templates::email-templates.form-fields-labels.template-name')) - ->hint(__('vb-email-templates::email-templates.form-fields-labels.template-name-hint')) - ->required(), + ->live() + ->label(__('vb-email-templates::email-templates.form-fields-labels.template-name')) + ->hint(__('vb-email-templates::email-templates.form-fields-labels.template-name-hint')) + ->required(), ] ), @@ -66,23 +67,32 @@ class EmailTemplateResource extends Resource ->schema( [ TextInput::make('key') - ->label(__('vb-email-templates::email-templates.form-fields-labels.key')) - ->hint(__('vb-email-templates::email-templates.form-fields-labels.key-hint')) - ->required() - ->unique(ignorable: fn ($record) => $record), + ->afterStateUpdated( + fn(Set $set, ?string $state) => $set('key', Str::slug($state))) + ->label(__('vb-email-templates::email-templates.form-fields-labels.key')) + ->hint(__('vb-email-templates::email-templates.form-fields-labels.key-hint')) + ->required() + ->unique(ignorable: fn($record) => $record), Select::make('language') - ->options($languages) - ->searchable() - ->allowHtml(), + ->options($formHelper->getLanguageOptions()) + ->default(config('email-templates.default_locale')) + ->searchable() + ->allowHtml(), Select::make('view') - ->label(__('vb-email-templates::email-templates.form-fields-labels.template-view')) - ->options($templates) - ->required(), - TextInput::make('from') - ->label(__('vb-email-templates::email-templates.form-fields-labels.email-from')) - ->required(), - TextInput::make('send_to') - ->label(__('vb-email-templates::email-templates.form-fields-labels.email-to')), + ->label(__('vb-email-templates::email-templates.form-fields-labels.template-view')) + ->options($templates) + ->default(current($templates)) + ->searchable() + ->required(), + TextInput::make('from')->default(config('mail.from.address')) + ->label(__('vb-email-templates::email-templates.form-fields-labels.email-from')) + ->required(), + Select::make('send_to') + ->label(__('vb-email-templates::email-templates.form-fields-labels.email-to')) + ->options($recipients) + ->default(current($recipients)) + ->searchable() + ->required(), ] ), @@ -90,19 +100,20 @@ class EmailTemplateResource extends Resource ->schema( [ TextInput::make('subject') - ->label(__('vb-email-templates::email-templates.form-fields-labels.subject')), + ->label(__('vb-email-templates::email-templates.form-fields-labels.subject')), TextInput::make('preheader') - ->label(__('vb-email-templates::email-templates.form-fields-labels.header')) - ->hint(__('vb-email-templates::email-templates.form-fields-labels.header-hint')), + ->label(__('vb-email-templates::email-templates.form-fields-labels.header')) + ->hint(__('vb-email-templates::email-templates.form-fields-labels.header-hint')), TextInput::make('title') - ->label(__('vb-email-templates::email-templates.form-fields-labels.title')) - ->hint(__('vb-email-templates::email-templates.form-fields-labels.title-hint')), + ->label(__('vb-email-templates::email-templates.form-fields-labels.title')) + ->hint(__('vb-email-templates::email-templates.form-fields-labels.title-hint')), TiptapEditor::make('content') - ->label(__('vb-email-templates::email-templates.form-fields-labels.content')) - ->profile('default'), + ->label(__('vb-email-templates::email-templates.form-fields-labels.content')) + ->profile('default') + ->default("

Dear ##user.firstname##,

") ] ), @@ -112,84 +123,6 @@ class EmailTemplateResource extends Resource ); } - public static function prepareLang() - { - $languages = config('email-templates.languages'); - - $preparedLang = []; - foreach ($languages as $langKey => $langVal) { - $preparedLang[ $langKey ] = - ' '.$langVal[ "display" ]; - } - - return $preparedLang; - } - - public static function getTemplateViewList() - { - $overrideDirectory = resource_path('views/vendor/vb-email-templates/email'); - $packageDirectory = dirname(view(config('email-templates.template_view_path').'.default')->getPath()); - - $directories = [$overrideDirectory, $packageDirectory]; - - $filenamesArray = []; - - foreach ($directories as $directory) { - if(file_exists($directory)) { - $filenamesArray = array_merge($filenamesArray, self::getFiles($directory, $directory)); - } - } - - // Remove duplicates - $filenamesArray = array_unique($filenamesArray); - - return array_combine($filenamesArray, $filenamesArray); - } - - /** - * Recursively get all files in a directory and children - */ - private static function getFiles($dir, $basepath) - { - $files = $subdirs = $subFiles = []; - - if($handle = opendir($dir)) { - while (false !== ($entry = readdir($handle))) { - if($entry == "." || $entry == "..") { - continue; - } - if(substr($entry, 0, 1) == '_') { - continue; - } - $entryPath = $dir.'/'.$entry; - if(is_dir($entryPath)) { - $subdirs[] = $entryPath; - } else { - $subFiles[] = str_replace( - '/', - '.', - str_replace( - '.blade.php', - '', - str_replace( - $basepath.'/', - '', - $entryPath - ) - ) - ); - } - } - closedir($handle); - sort($subFiles); - $files = array_merge($files, $subFiles); - foreach ($subdirs as $subdir) { - $files = array_merge($files, self::getFiles($subdir, $basepath)); - } - } - - return $files; - } public static function table(Table $table): Table { @@ -197,71 +130,70 @@ class EmailTemplateResource extends Resource [ TextColumn::make('id'), TextColumn::make('name') - ->limit(50) - ->sortable() - ->searchable(), + ->limit(50) + ->sortable() + ->searchable(), TextColumn::make('language') - ->limit(50), + ->limit(50), TextColumn::make('subject') - ->limit(50), + ->limit(50), ] ) - ->filters( - [ - Tables\Filters\TrashedFilter::make(), - ] - ) - ->actions( - [ - Action::make('create-mail-class') - ->label("Create Mail Class") - ->icon('heroicon-o-document-text') - // ->action('createMailClass'), - ->action(function ($record) { - $createMailableHelper = app(\Visualbuilder\EmailTemplates\Contracts\CreateMailableInterface::class); - $notify = $createMailableHelper->createMailable($record); - // dd($record); - Notification::make() - ->title($notify->title) - ->icon($notify->icon) - ->iconColor($notify->icon_color) - ->send(); - }), - Tables\Actions\ViewAction::make() - ->label("Preview") - ->hidden(fn ($record) => $record->trashed()), - Tables\Actions\EditAction::make(), - Tables\Actions\DeleteAction::make(), - Tables\Actions\ForceDeleteAction::make(), - Tables\Actions\RestoreAction::make(), - ] - ) - ->bulkActions( - [ - Tables\Actions\DeleteBulkAction::make(), - Tables\Actions\ForceDeleteBulkAction::make(), - Tables\Actions\RestoreBulkAction::make(), - ] - ); + ->filters( + [ + Tables\Filters\TrashedFilter::make(), + ] + ) + ->actions( + [ + Action::make('create-mail-class') + ->label("Create Mail Class") + ->icon('heroicon-o-document-text') + // ->action('createMailClass'), + ->action(function ($record) { + $notify = $this->mailHelper->createMailable($record); + // dd($record); + Notification::make() + ->title($notify->title) + ->icon($notify->icon) + ->iconColor($notify->icon_color) + ->send(); + }), + Tables\Actions\ViewAction::make() + ->label("Preview") + ->hidden(fn($record) => $record->trashed()), + Tables\Actions\EditAction::make(), + Tables\Actions\DeleteAction::make(), + Tables\Actions\ForceDeleteAction::make(), + Tables\Actions\RestoreAction::make(), + ] + ) + ->bulkActions( + [ + Tables\Actions\DeleteBulkAction::make(), + Tables\Actions\ForceDeleteBulkAction::make(), + Tables\Actions\RestoreBulkAction::make(), + ] + ); } public static function getPages(): array { return [ - 'index' => Pages\ListEmailTemplates::route('/'), + 'index' => Pages\ListEmailTemplates::route('/'), 'create' => Pages\CreateEmailTemplate::route('/create'), - 'edit' => Pages\EditEmailTemplate::route('/{record}/edit'), - 'view' => Pages\PreviewEmailTemplate::route('/{record}'), + 'edit' => Pages\EditEmailTemplate::route('/{record}/edit'), + 'view' => Pages\PreviewEmailTemplate::route('/{record}'), ]; } public static function getEloquentQuery(): Builder { return parent::getEloquentQuery() - ->withoutGlobalScopes( - [ - SoftDeletingScope::class, - ] - ); + ->withoutGlobalScopes( + [ + SoftDeletingScope::class, + ] + ); } }