Skip to content

Instantly share code, notes, and snippets.

@sulemani39
Created August 2, 2025 08:22
Show Gist options
  • Save sulemani39/9b7481b92737629664a6440fc7eabbc7 to your computer and use it in GitHub Desktop.
Save sulemani39/9b7481b92737629664a6440fc7eabbc7 to your computer and use it in GitHub Desktop.
public function index()
{
$produk = Produk::all();
return view('produk.index', compact('produk'));
}
public function store(Request $request)
{
$request->validate([
'nama' => 'required',
'harga' => 'required|numeric',
]);
Produk::create($request->all());
return redirect('/produk')->with('sukses', 'Produk berhasil disimpan');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment