add debuging for fotoController
This commit is contained in:
parent
19e7f729e2
commit
ffdbf8be3d
|
|
@ -56,11 +56,37 @@ public function store(Request $request)
|
|||
->with('error_modal', 'createFoto'); // Agar modal terbuka otomatis saat error
|
||||
}
|
||||
|
||||
$path = null;
|
||||
if ($request->hasFile('foto')) {
|
||||
$file = $request->file('foto');
|
||||
$filename = time() . '_' . $file->getClientOriginalName();
|
||||
$path = $file->storeAs('img/foto', $filename, 'public');
|
||||
// $path = null;
|
||||
// if ($request->hasFile('foto')) {
|
||||
// $file = $request->file('foto');
|
||||
// $filename = time() . '_' . $file->getClientOriginalName();
|
||||
// $path = $file->storeAs('img/foto', $filename, 'public');
|
||||
// }
|
||||
|
||||
// PaketFoto::create([
|
||||
// 'nama' => $request->nama,
|
||||
// 'harga' => $request->harga,
|
||||
// 'durasi' => $request->durasi,
|
||||
// 'deskripsi' => $request->deskripsi,
|
||||
// 'foto' => $path,
|
||||
// ]);
|
||||
|
||||
// return redirect()->back()->with('success', 'Paket foto baru berhasil ditambahkan!');
|
||||
|
||||
if (!$request->hasFile('foto')) {
|
||||
return redirect()->back()
|
||||
->with('error', 'File foto tidak ditemukan!')
|
||||
->withInput();
|
||||
}
|
||||
|
||||
$file = $request->file('foto');
|
||||
$filename = time() . '_' . $file->getClientOriginalName();
|
||||
$path = $file->storeAs('img/foto', $filename, 'public');
|
||||
|
||||
if (!$path) {
|
||||
return redirect()->back()
|
||||
->with('error', 'Gagal upload file!')
|
||||
->withInput();
|
||||
}
|
||||
|
||||
PaketFoto::create([
|
||||
|
|
|
|||
Loading…
Reference in New Issue