public function getTambah(Request $request) { $data['sarana'] = Sarana::paginate(10); $dt = new Sarana(); $dt->jenis = $request->jenis; $dt->sub = $request->sub; $dt->save(); return redirect()->route('saranapembudidaya', $data); }
public function getTambah(Request $request) { $data['sarana'] = Sarana::paginate(10); /* Validasi */ $this->validate($request, ['sub' => 'required|unique:app_sarana', 'jenis' => 'required']); /* end validasi */ $dt = new Sarana(); $dt->jenis = $request->jenis; $dt->sub = $request->sub; $dt->tipe = 'Nelayan'; $dt->save(); return redirect()->route('sarananelayan', $data)->with(session()->flash('success', 'Data Berhasil Tersimpan !!')); }
public function getTambah(Request $request) { $data['sarana'] = Sarana::paginate(10); /* Validasi */ $this->validate($request, ['sub' => 'required', 'jenis' => 'required']); $vb = Sarana::where('sub', $request->sub)->where('jenis', $request->jenis)->count(); if ($vb > 0) { return redirect()->route('saranapembudidaya')->with(session()->flash('gagal', 'Data Sudah ada !!')); } /* end validasi */ $dt = new Sarana(); $dt->jenis = $request->jenis; $dt->sub = $request->sub; $dt->save(); return redirect()->route('saranapembudidaya', $data)->with(session()->flash('success', 'Data Berhasil Tersimpan !!')); }