51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
			
		
		
	
	
			51 lines
		
	
	
		
			1.5 KiB
		
	
	
	
		
			PHP
		
	
	
	
| <?php
 | |
| 
 | |
| namespace Modules\Form\Components;
 | |
| 
 | |
| use App\Lib\Editor\EditorData;
 | |
| use App\Prevention\PreventionSettings;
 | |
| use Livewire\Component;
 | |
| 
 | |
| class PreventionSettingView extends Component
 | |
| {
 | |
| 
 | |
|     public EditorData $formmail;
 | |
|     public $settingClass = PreventionSettings::class;
 | |
| 
 | |
|     public function rules(): array
 | |
|     {
 | |
|         return [
 | |
|             'formmail' => 'array',
 | |
|         ];
 | |
|     }
 | |
| 
 | |
|     public function mount(): void
 | |
|     {
 | |
|         $this->formmail = app(PreventionSettings::class)->formmail;
 | |
|     }
 | |
| 
 | |
|     public function save(): void
 | |
|     {
 | |
|         app(PreventionSettings::class)->fill(['formmail' => $this->formmail])->save();
 | |
|         $this->dispatch('success', 'Einstellungen gespeichert.');
 | |
|     }
 | |
| 
 | |
|     public function render()
 | |
|     {
 | |
|         return <<<'HTML'
 | |
|             <x-page::setting-layout :active="$settingClass">
 | |
|                 <x-slot:right>
 | |
|                     <x-form::save-button form="preventionsettingform"></x-form::save-button>
 | |
|                 </x-slot:right>
 | |
|                 <form id="preventionsettingform" class="grow p-6 grid grid-cols-1 gap-3 items-start content-start"
 | |
|                     wire:submit.prevent="save">
 | |
|                     <x-ui::setting-intro>
 | |
|                         Hier kannst du Einstellungen zu Prävention setzen.
 | |
|                     </x-ui::setting-intro>
 | |
|                     <x-form::editor hint="lala" name="frommail" wire:model="formmail" label="E-Mail für Veranstaltungs-TN"></x-form::editor>
 | |
|                 </form>
 | |
|             </x-page::setting-layout>
 | |
|         HTML;
 | |
|     }
 | |
| }
 |