diff --git a/app/Http/Controllers/Data/DataUmumController.php b/app/Http/Controllers/Data/DataUmumController.php index 6871e7450..be9f7d6c4 100644 --- a/app/Http/Controllers/Data/DataUmumController.php +++ b/app/Http/Controllers/Data/DataUmumController.php @@ -32,6 +32,7 @@ namespace App\Http\Controllers\Data; use App\Http\Controllers\Controller; +use App\Http\Requests\DataUmumRequest; use App\Models\DataUmum; use Illuminate\Http\Request; use Illuminate\Http\Response; @@ -59,33 +60,8 @@ public function index() * @param int $id * @return Response */ - public function update(Request $request, $id) + public function update(DataUmumRequest $request, $id) { - request()->validate([ - 'sejarah' => 'required', - 'sumber_luas_wilayah' => 'required', - 'luas_wilayah' => 'required', - 'bts_wil_utara' => 'required', - 'bts_wil_timur' => 'required', - 'bts_wil_selatan' => 'required', - 'bts_wil_barat' => 'required', - 'jml_puskesmas' => 'required', - 'jml_puskesmas_pembantu' => 'required', - 'jml_posyandu' => 'required', - 'jml_pondok_bersalin' => 'required', - 'jml_paud' => 'required', - 'jml_sd' => 'required', - 'jml_smp' => 'required', - 'jml_sma' => 'required', - 'jml_masjid_besar' => 'required', - 'jml_mushola' => 'required', - 'jml_gereja' => 'required', - 'jml_pasar' => 'required', - 'jml_balai_pertemuan' => 'required', - 'lat' => 'required', - 'lng' => 'required', - ]); - try { $data = ($request->sumber_luas_wilayah == 1) ? $request->all() : $request->except('luas_wilayah'); DataUmum::findOrFail($id)->update($data); diff --git a/app/Http/Controllers/FrontEnd/ProfilController.php b/app/Http/Controllers/FrontEnd/ProfilController.php index 01cc221df..9d9ce252e 100644 --- a/app/Http/Controllers/FrontEnd/ProfilController.php +++ b/app/Http/Controllers/FrontEnd/ProfilController.php @@ -41,6 +41,19 @@ class ProfilController extends FrontEndController { + public function tipologi() + { + Counter::count('profil.tipologi'); + + $profil = Profil::with(['dataUmum'])->first(); + $page_title = 'Tipologi'; + if (isset($profil)) { + $page_description = $this->browser_title; + } + + return view('pages.profil.tipologi', compact('page_title', 'page_description', 'profil')); + } + public function sejarah() { Counter::count('profil.sejarah'); diff --git a/app/Http/Requests/DataUmumRequest.php b/app/Http/Requests/DataUmumRequest.php new file mode 100644 index 000000000..02a58246a --- /dev/null +++ b/app/Http/Requests/DataUmumRequest.php @@ -0,0 +1,81 @@ + 'required', + 'sejarah' => 'required', + 'sumber_luas_wilayah' => 'required', + 'luas_wilayah' => 'required', + 'bts_wil_utara' => 'required', + 'bts_wil_timur' => 'required', + 'bts_wil_selatan' => 'required', + 'bts_wil_barat' => 'required', + 'jml_puskesmas' => 'required', + 'jml_puskesmas_pembantu' => 'required', + 'jml_posyandu' => 'required', + 'jml_pondok_bersalin' => 'required', + 'jml_paud' => 'required', + 'jml_sd' => 'required', + 'jml_smp' => 'required', + 'jml_sma' => 'required', + 'jml_masjid_besar' => 'required', + 'jml_mushola' => 'required', + 'jml_gereja' => 'required', + 'jml_pasar' => 'required', + 'jml_balai_pertemuan' => 'required', + 'lat' => 'required', + 'lng' => 'required', + ]; + } +} diff --git a/app/Models/DataUmum.php b/app/Models/DataUmum.php index 994947acc..2c95b87f8 100644 --- a/app/Models/DataUmum.php +++ b/app/Models/DataUmum.php @@ -39,6 +39,7 @@ class DataUmum extends Model protected $table = 'das_data_umum'; protected $fillable = [ + 'tipologi', 'sejarah', 'ketinggian', 'sumber_luas_wilayah', diff --git a/database/migrations/2024_06_25_131925_add_tipologi_data_umum.php b/database/migrations/2024_06_25_131925_add_tipologi_data_umum.php new file mode 100644 index 000000000..f8d0b3c48 --- /dev/null +++ b/database/migrations/2024_06_25_131925_add_tipologi_data_umum.php @@ -0,0 +1,60 @@ +longText('tipologi')->nullable(true)->after('profil_id'); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::table('das_data_umum', function (Blueprint $table) { + $table->dropColumn('tipologi'); + }); + } +}; diff --git a/resources/views/data/data_umum/form_edit.blade.php b/resources/views/data/data_umum/form_edit.blade.php index 59407a4c8..73c48b5cd 100644 --- a/resources/views/data/data_umum/form_edit.blade.php +++ b/resources/views/data/data_umum/form_edit.blade.php @@ -9,6 +9,14 @@ +
+ + +
+ {!! Form::textarea('tipologi', null, ['placeholder' => 'Tipologi', 'class' => 'form-control my-editor', 'rows' => 2]) !!} +
+
+
diff --git a/resources/views/layouts/frontends/header.blade.php b/resources/views/layouts/frontends/header.blade.php index c75241c40..a20ec486c 100644 --- a/resources/views/layouts/frontends/header.blade.php +++ b/resources/views/layouts/frontends/header.blade.php @@ -23,6 +23,7 @@