Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lihat daftar prosedur pada web di menu unduhan - eror 500 #442

Merged
merged 3 commits into from
Jun 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/Http/Controllers/Informasi/ProsedurController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion app/Http/Controllers/Page/DownloadController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
Expand Down
1 change: 1 addition & 0 deletions app/Models/Prosedur.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@ class Prosedur extends Model
'judul_prosedur',
'file_prosedur',
'mime_type',
'slug'
];
}
3 changes: 3 additions & 0 deletions catatan_rilis.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

65 changes: 65 additions & 0 deletions database/migrations/2022_06_22_205014_add_slug_prosedur.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
<?php

/*
* File ini bagian dari:
*
* OpenDK
*
* Aplikasi dan source code ini dirilis berdasarkan lisensi GPL V3
*
* Hak Cipta 2017 - 2022 Perkumpulan Desa Digital Terbuka (https://opendesa.id)
*
* Dengan ini diberikan izin, secara gratis, kepada siapa pun yang mendapatkan salinan
* dari perangkat lunak ini dan file dokumentasi terkait ("Aplikasi Ini"), untuk diperlakukan
* tanpa batasan, termasuk hak untuk menggunakan, menyalin, mengubah dan/atau mendistribusikan,
* asal tunduk pada syarat berikut:
*
* Pemberitahuan hak cipta di atas dan pemberitahuan izin ini harus disertakan dalam
* setiap salinan atau bagian penting Aplikasi Ini. Barang siapa yang menghapus atau menghilangkan
* pemberitahuan ini melanggar ketentuan lisensi Aplikasi Ini.
*
* PERANGKAT LUNAK INI DISEDIAKAN "SEBAGAIMANA ADANYA", TANPA JAMINAN APA PUN, BAIK TERSURAT MAUPUN
* TERSIRAT. PENULIS ATAU PEMEGANG HAK CIPTA SAMA SEKALI TIDAK BERTANGGUNG JAWAB ATAS KLAIM, KERUSAKAN ATAU
* KEWAJIBAN APAPUN ATAS PENGGUNAAN ATAU LAINNYA TERKAIT APLIKASI INI.
*
* @package OpenDK
* @author Tim Pengembang OpenDesa
* @copyright Hak Cipta 2017 - 2022 Perkumpulan Desa Digital Terbuka (https://opendesa.id)
* @license http://www.gnu.org/licenses/gpl.html GPL V3
* @link https://github.com/OpenSID/opendk
*/

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class AddSlugProsedur extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::table('das_prosedur', function (Blueprint $table) {
$table->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');
});
}
}