diff --git a/app/Http/Controllers/FrontEnd/DownloadController.php b/app/Http/Controllers/FrontEnd/DownloadController.php
index b9343a468..8981cf8c7 100644
--- a/app/Http/Controllers/FrontEnd/DownloadController.php
+++ b/app/Http/Controllers/FrontEnd/DownloadController.php
@@ -35,8 +35,10 @@
use App\Http\Controllers\FrontEndController;
use App\Models\Prosedur;
use App\Models\Regulasi;
-use Illuminate\Support\Facades\DB;
+use App\Models\FormDokumen;
use Yajra\DataTables\DataTables;
+use Illuminate\Support\Facades\DB;
+use App\Http\Controllers\Controller;
class DownloadController extends FrontEndController
{
@@ -118,28 +120,17 @@ public function indexFormDokumen()
public function getDataDokumen()
{
- $query = DB::table('das_form_dokumen')->selectRaw('id, nama_dokumen, file_dokumen');
-
- return DataTables::of($query->get())
+ return DataTables::of(FormDokumen::query())
->addColumn('aksi', function ($row) {
- $data['download_url'] = asset($row->file_dokumen);
+ $data['show_url'] = asset($row->file_dokumen);
+ $data['download_url'] = route('unduhan.form-dokumen.download', $row->id);
return view('forms.aksi', $data);
})->make();
}
- public function showDokumen($nama_dokumen)
- {
- $dokumen = dokumen::where('judul', str_replace('-', ' ', $nama_regulasi))->first();
- $page_title = 'Detail Dokumen :'.$dokumen->judul;
-
- return view('pages.unduhan.dokumen_show', compact('page_title', 'dokumen'));
- }
-
- public function downloadDokumen($file)
+ public function downloadDokumen(FormDokumen $file)
{
- $getFile = Dokumen::where('judul', str_replace('-', ' ', $file))->firstOrFail();
-
- return response()->download($getFile->file_dokumen);
+ return response()->download($file->file_dokumen);
}
}
diff --git a/catatan_rilis.md b/catatan_rilis.md
index 89ae82f6a..fbc4fdbb0 100644
--- a/catatan_rilis.md
+++ b/catatan_rilis.md
@@ -5,6 +5,7 @@ Di rilis versi v2406.1.0 di versi ini terdapat [untuk diisi] dan perbaikan lain
1. [#262](https://github.com/OpenSID/OpenDK/issues/262) Penambahan modul themes.
2. [#960](https://github.com/OpenSID/OpenDK/issues/960) Penambahan filter berdasarkan desa pada modul berkaitan dengan data desa.
+3. [#962](https://github.com/OpenSID/OpenDK/issues/962) Penambahan unduh dan lihat pada halaman unduhan dokumen website.
#### BUG
diff --git a/resources/views/forms/aksi.blade.php b/resources/views/forms/aksi.blade.php
index 7a3537867..c0e568713 100644
--- a/resources/views/forms/aksi.blade.php
+++ b/resources/views/forms/aksi.blade.php
@@ -15,7 +15,7 @@
@endif
@if (isset($show_url))
-
+
@endif
diff --git a/routes/web.php b/routes/web.php
index a5fe9b4d4..2da797d9f 100644
--- a/routes/web.php
+++ b/routes/web.php
@@ -166,6 +166,7 @@
Route::permanentRedirect('/', '/');
Route::get('/', 'DownloadController@indexFormDokumen')->name('unduhan.form-dokumen');
Route::get('getdata', 'DownloadController@getDataDokumen')->name('unduhan.form-dokumen.getdata');
+ Route::get('unduh/{file}', 'DownloadController@downloadDokumen')->name('unduhan.form-dokumen.download');
});
});