simpan dan edit bersamaan di 2 tabel yang berbeda

selamat sore....

bagaimana cara simpan dan sekaligus edit data di tabel berbeda dengan laravel... mohon petunjuknya...

terimakasih

avatar bgpoels
@bgpoels

35 Kontribusi 2 Poin

Dipost 3 tahun yang lalu

Tanggapan

Pertanyaan kamu tidak jelas, coba dijelaskan lebih baik

1 Jawaban:

<div>maksud nya begini gan...<br>disaat tombol simpan diklik maka data tersimpan ke tabel permohonan dan tabel kwitansi untuk fields status juga dapat teredit berdasarkan nomor indeks nya...<br><br>berikut ini script tombol simpannya<br><br>public function store(Request $request)<br>&nbsp; &nbsp; {<br>&nbsp; &nbsp; &nbsp; &nbsp; $request-&gt;validate([<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'no_register_permohonan'=&gt;'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'tgl_register_permohonan'=&gt;'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'no_register'=&gt;'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'tgl_register'=&gt;'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'no_skpd' =&gt; 'required|unique:permohonans',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'nama_pemilik' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'nama_perusahaan' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'npwpd' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'no_telp' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'almt' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'tgl_skpd' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'jns_reklame' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'tema_reklame' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'jlhsisi' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'ukuran_reklame' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'jlhreklame' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'masa_pajak' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'lokasi_pemasangan' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'pajak_reklame' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'ujb' =&gt; 'required',<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 'status_ujb' =&gt; 'required',<br><br>&nbsp; &nbsp; &nbsp; &nbsp; ]);<br>&nbsp; &nbsp; &nbsp; &nbsp; $request-&gt;merge(['pajak_reklame' =&gt; currencyIDRToNumeric($request-&gt;pajak_reklame)]);<br>&nbsp; &nbsp; &nbsp; &nbsp; $request-&gt;merge(['ujb' =&gt; currencyIDRToNumeric($request-&gt;ujb)]);<br>&nbsp; &nbsp; &nbsp; &nbsp; Permohonan::create($request-&gt;all());<br>&nbsp; &nbsp; &nbsp; &nbsp; return redirect()-&gt;route('indexper')<br>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -&gt;with('success', 'Permohonan Pembongkaran UJB telah disimpan ke Database');<br>&nbsp; &nbsp; }<br><br>yang saya ingin tanyakan bagaimana menyisipkan script edit untuk tabel kwitansinya... mksh gan</div>

avatar bgpoels
@bgpoels

35 Kontribusi 2 Poin

Dipost 3 tahun yang lalu

Login untuk ikut Jawaban