Laravel 11, Vuexy Admin 10.3, by admin@koneko.mx

This commit is contained in:
2025-01-25 04:23:40 -06:00
parent c3045b43b1
commit 64d505910f
1283 changed files with 140198 additions and 0 deletions

View File

@ -0,0 +1,61 @@
<?php
namespace Modules\Admin\App\Livewire\WebsiteSettings;
use Livewire\Component;
use App\Services\WebsiteTemplateService;
class TemplateSettings extends Component
{
private $targetNotify = "#website-template-settings-card .notification-container";
public $website_tpl_style_switcher,
$website_tpl_footer_text;
protected $listeners = ['saveTemplateSettings' => 'save'];
public function mount()
{
$this->loadSettings();
}
public function loadSettings()
{
$websiteTemplateService = app(WebsiteTemplateService::class);
// Obtener los valores de las configuraciones de la base de datos
$settings = $websiteTemplateService->getWebsiteVars();
$this->website_tpl_style_switcher = $settings['template']['style_switcher'];
$this->website_tpl_footer_text = $settings['template']['footer_text'];
}
public function save()
{
$this->validate([
'website_tpl_footer_text' => 'nullable|string|max:50',
]);
$websiteTemplateService = app(WebsiteTemplateService::class);
// Guardar título del App en configuraciones
$websiteTemplateService->updateSetting('website_tpl_style_switcher', $this->website_tpl_style_switcher);
$websiteTemplateService->updateSetting('website_tpl_footer_text', $this->website_tpl_footer_text);
$websiteTemplateService->clearWebsiteVarsCache();
$this->loadSettings();
$this->dispatch(
'notification',
target: $this->targetNotify,
type: 'success',
message: 'Se han guardado los cambios en las configuraciones.'
);
}
public function render()
{
return view('admin::livewire.website-settings.template-settings');
}
}