This commit is contained in:
Bozhidar 2024-09-27 16:29:51 +03:00
parent 97483c85f2
commit 6241f2c85c
3 changed files with 54 additions and 4 deletions

View file

@ -11,6 +11,7 @@ use Filament\Tables;
use Filament\Tables\Table;
use Illuminate\Database\Eloquent\Builder;
use Illuminate\Database\Eloquent\SoftDeletingScope;
use Modules\Email\App\Http\Livewire\DkimSetup;
use Modules\Email\App\Models\EmailBox;
use Modules\Email\DkimDomainSetup;
@ -47,11 +48,14 @@ class EmailDomainResource extends Resource
//
])
->actions([
Tables\Actions\Action::make('dkimSetup')
Tables\Actions\ViewAction::make('dkimSetup')
->label('DKIM Setup')
->action(function (Domain $record) {
$output = DkimDomainSetup::run($record->domain);
dd($output);
->form(function (Domain $record) {
return [
Forms\Components\Livewire::make(DkimSetup::class, [
'domain' => $record->domain,
]),
];
})
->icon('heroicon-o-pencil'),
])

View file

@ -0,0 +1,27 @@
<?php
namespace Modules\Email\App\Http\Livewire;
use Livewire\Component;
use Modules\Email\DkimDomainSetup;
class DkimSetup extends Component
{
public $domain;
public function render()
{
$secure = $this->secure();
return view('email::livewire.dkim-setup', [
'secure' => $secure,
]);
}
public function secure()
{
$output = DkimDomainSetup::run($this->domain);
return $output;
}
}

View file

@ -0,0 +1,19 @@
<div>
@if(isset($secure['text']))
<div class="w-full p-2">
Please add the following DNS record to your domain's DNS settings:
</div>
<div class="w-full mt-2">
<textarea rows="10" class="w-full p-4 rounded-md border-2 border-gray-100">
{{ $secure['text'] }}
</textarea>
</div>
<x-filament::button wire:click="verify">
Check DNS Record
</x-filament::button>
@endif
</div>