Primo commit

This commit is contained in:
Francesco Picone
2026-04-05 19:26:04 +02:00
commit 701f479b7f
135 changed files with 21445 additions and 0 deletions

View File

@@ -0,0 +1,53 @@
<?php
namespace App\Livewire\Proclamatori;
use Livewire\Component;
use App\Models\Proclamatore;
class ProclamatoreEdit extends Component
{
public Proclamatore $proclamatore;
public string $nome = '';
public string $cognome = '';
public bool $attivo = true;
public function mount(Proclamatore $proclamatore)
{
$this->proclamatore = $proclamatore;
$this->nome = $proclamatore->nome;
$this->cognome = $proclamatore->cognome;
$this->attivo = $proclamatore->attivo;
}
protected function rules(): array
{
return [
'nome' => 'required|string|max:100',
'cognome' => 'required|string|max:100',
'attivo' => 'boolean',
];
}
public function save()
{
$this->validate();
$this->proclamatore->update([
'nome' => $this->nome,
'cognome' => $this->cognome,
'attivo' => $this->attivo,
]);
session()->flash('success', "Proclamatore {$this->proclamatore->nome_completo} aggiornato.");
return $this->redirect(route('proclamatori.index'), navigate: true);
}
public function render()
{
return view('livewire.proclamatori.proclamatore-form', [
'titolo' => "Modifica {$this->proclamatore->nome_completo}",
'btnLabel' => 'Salva Modifiche',
]);
}
}