From abdabcd0a7793c04c526fc7997934a1278ce1321 Mon Sep 17 00:00:00 2001 From: vickyrolanda <59082428+vickyrolanda@users.noreply.github.com> Date: Thu, 9 Jun 2022 16:25:21 +0700 Subject: [PATCH] Solusi Eror 500 Ketika Klik lihat prosedur --- app/Http/Controllers/Informasi/ProsedurController.php | 2 ++ app/Http/Controllers/Page/DownloadController.php | 2 +- app/Models/Prosedur.php | 1 + 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Http/Controllers/Informasi/ProsedurController.php b/app/Http/Controllers/Informasi/ProsedurController.php index 34b0453ec..52fbf8181 100644 --- a/app/Http/Controllers/Informasi/ProsedurController.php +++ b/app/Http/Controllers/Informasi/ProsedurController.php @@ -87,6 +87,7 @@ public function store(ProsedurRequest $request) $file->move($path, $file_name); $input['file_prosedur'] = $path . $file_name; + $input['slug'] = str_slug($request->input('judul_prosedur')); $input['mime_type'] = $file->getClientOriginalExtension(); } @@ -131,6 +132,7 @@ public function update(Prosedur $prosedur, ProsedurRequest $request) $input['file_prosedur'] = $path . $file_name; $input['mime_type'] = $file->getClientOriginalExtension(); } + $input['slug'] = str_slug($request->input('judul_prosedur')); $prosedur->update($input); } catch (\Exception $e) { diff --git a/app/Http/Controllers/Page/DownloadController.php b/app/Http/Controllers/Page/DownloadController.php index 74070b3da..59af7e7d8 100644 --- a/app/Http/Controllers/Page/DownloadController.php +++ b/app/Http/Controllers/Page/DownloadController.php @@ -66,7 +66,7 @@ public function getDataProsedur() public function showProsedur($nama_prosedur) { - $prosedur = Prosedur::where('judul_prosedur', str_replace('-', ' ', $nama_prosedur))->first(); + $prosedur = Prosedur::where('slug', $nama_prosedur)->first(); $page_title = 'Detail Prosedur :' . $prosedur->judul_prosedur; return view('pages.unduhan.prosedur_show', compact('page_title', 'prosedur')); diff --git a/app/Models/Prosedur.php b/app/Models/Prosedur.php index 2e6740177..1e070917d 100755 --- a/app/Models/Prosedur.php +++ b/app/Models/Prosedur.php @@ -41,5 +41,6 @@ class Prosedur extends Model 'judul_prosedur', 'file_prosedur', 'mime_type', + 'slug', ]; }