diff --git a/app/Http/Controllers/Informasi/ProsedurController.php b/app/Http/Controllers/Informasi/ProsedurController.php index 34b0453ec..53b89be16 100644 --- a/app/Http/Controllers/Informasi/ProsedurController.php +++ b/app/Http/Controllers/Informasi/ProsedurController.php @@ -85,7 +85,7 @@ public function store(ProsedurRequest $request) $file_name = time() . rand(100, 999) . '_' . $original_name; $path = "storage/regulasi/"; $file->move($path, $file_name); - + $input['slug'] = str_slug($request->input('judul_prosedur')); $input['file_prosedur'] = $path . $file_name; $input['mime_type'] = $file->getClientOriginalExtension(); } @@ -131,6 +131,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..8e01184a9 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' ]; } diff --git a/catatan_rilis.md b/catatan_rilis.md index 625da19bb..c5855f61e 100644 --- a/catatan_rilis.md +++ b/catatan_rilis.md @@ -10,8 +10,11 @@ Terima kasih pada [untuk diisi] yang terus berkontribusi. Terima kasih pula pada #### Perbaikan BUG +1. [#430](https://github.com/OpenSID/OpenDK/issues/430) Perbaiki ihat daftar prosedur di menu unduhan error 500. + #### TEKNIS + 1. [#427](https://github.com/OpenSID/OpenDK/pull/427) Teknis perbaiki error 500 setelah login. 2. [#431](https://github.com/OpenSID/OpenDK/pull/431) Teknis ignore .phpcs-cache diff --git a/database/migrations/2022_06_22_205014_add_slug_prosedur.php b/database/migrations/2022_06_22_205014_add_slug_prosedur.php new file mode 100644 index 000000000..1590fe1b6 --- /dev/null +++ b/database/migrations/2022_06_22_205014_add_slug_prosedur.php @@ -0,0 +1,65 @@ +char('slug', 50)->after('judul_prosedur')->nullable(false); + }); + + // update data slug pada das prosedur + DB::table('das_prosedur')->update(['slug' => DB::raw("lower(replace(judul_prosedur, ' ' , '-'))")]); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('das_prosedur', function (Blueprint $table) { + $table->dropColumn('slug'); + }); + } +}