Contoh Validatsi FOrm Pada Livewire 3
public $NO_URUT, $BUKU, $NO_AGENDA_INV, $NO_INDUK_EXS, $JUDUL_BUKU, $EDISI, $NAMA_PENGARANG, $NAMA_PENERBIT, $TEMPAT_TERBIT, $TAHUN, $ISBN, $NO_PANGGIL, $NO_KLASIFIKASI, $JML_esx, $UKURAN_BUKU, $KET;
protected $rules = [
'NO_URUT' => 'required|integer',
'BUKU' => 'required|string',
'NO_AGENDA_INV' => 'required|string',
'NO_INDUK_EXS' => 'required|string',
'JUDUL_BUKU' => 'required|string',
'EDISI' => 'required|string',
'NAMA_PENGARANG' => 'required|string',
'NAMA_PENERBIT' => 'required|string',
'TEMPAT_TERBIT' => 'required|string',
'TAHUN' => 'required|integer',
'ISBN' => 'required|string',
'NO_PANGGIL' => 'required|string',
'NO_KLASIFIKASI' => 'required|string',
'JML_esx' => 'required|integer',
'UKURAN_BUKU' => 'required|string',
'KET' => 'required|string',
];
public function simpan()
{
// $x = $this->form->all();
// dd($x);
$this->validate();
//dd($validate);
$data = $this->all();
unset($data["field"]);
simpan_data("buku", $data);
$this->reset();
$this->pesan = "<div class='alert alert-info'>Berhasil di Simpan</div>";
}
Lanjut Part : 1
Muhammad Ullil Fahri
WA : 089696380422
Tautan WA : https://wa.me/message/SG4YA2XQP5FPE1