diff --git a/app/Http/Controllers/Admin/ArtikelBudidayaController.php b/app/Http/Controllers/Admin/ArtikelBudidayaController.php new file mode 100644 index 0000000..0180964 --- /dev/null +++ b/app/Http/Controllers/Admin/ArtikelBudidayaController.php @@ -0,0 +1,129 @@ +paginate(10); + return view('admin.artikel-budidaya.index', compact('artikels')); + } + + public function create() + { + return view('admin.artikel-budidaya.create'); + } + + public function store(Request $request) + { + $validated = $request->validate([ + 'judul' => 'required|string|max:200', + 'deskripsi_singkat' => 'nullable|string', + 'konten' => 'required|string', + 'gambar_utama' => 'nullable|image|max:2048', + 'galeri_gambar.*' => 'nullable|image|max:2048', + 'file_pdf' => 'nullable|mimes:pdf|max:5120', + 'tags' => 'nullable|string', + 'is_published' => 'boolean', + ]); + + $validated['slug'] = Str::slug($request->judul); + $validated['created_by'] = auth()->id(); + $validated['is_published'] = $request->has('is_published') ? 1 : 0; + + if ($request->hasFile('gambar_utama')) { + $validated['gambar_utama'] = $request->file('gambar_utama')->store('budidaya/gambar', 'public'); + } + + if ($request->hasFile('file_pdf')) { + $validated['file_pdf'] = $request->file('file_pdf')->store('budidaya/pdf', 'public'); + } + + // Handle galeri gambar + if ($request->hasFile('galeri_gambar')) { + $galeri = []; + foreach ($request->file('galeri_gambar') as $foto) { + $galeri[] = $foto->store('budidaya/galeri', 'public'); + } + $validated['galeri_gambar'] = $galeri; // otomatis di-cast ke JSON oleh model + } + + // Handle tags + $tagsDecoded = json_decode($request->tags, true); + $validated['tags'] = (!empty($tagsDecoded)) ? $tagsDecoded : null; + + if ($validated['is_published']) { + $validated['published_at'] = now(); + } + + InformasiBudidaya::create($validated); + + return redirect()->route('admin.artikel-budidaya.index') + ->with('success', 'Artikel budidaya berhasil ditambahkan!'); +} + + public function edit(InformasiBudidaya $artikelBudidaya) + { + return view('admin.artikel-budidaya.edit', compact('artikelBudidaya')); + } + + public function update(Request $request, InformasiBudidaya $artikelBudidaya) + { + $validated = $request->validate([ + 'judul' => 'required|string|max:200', + 'deskripsi_singkat'=> 'nullable|string', + 'konten' => 'required|string', + 'gambar_utama' => 'nullable|image|max:2048', + 'galeri_gambar.*' => 'nullable|image|max:2048', + 'file_pdf' => 'nullable|mimes:pdf|max:5120', + 'tags' => 'nullable|string', + 'is_published' => 'boolean', + ]); + + $validated['slug'] = Str::slug($request->judul); + $validated['is_published'] = $request->has('is_published') ? 1 : 0; + + if ($request->hasFile('gambar_utama')) { + $validated['gambar_utama'] = $request->file('gambar_utama')->store('budidaya/gambar', 'public'); + } + + if ($request->hasFile('file_pdf')) { + $validated['file_pdf'] = $request->file('file_pdf')->store('budidaya/pdf', 'public'); + } + + // Handle galeri gambar + if ($request->hasFile('galeri_gambar')) { + $galeri = []; + foreach ($request->file('galeri_gambar') as $foto) { + $galeri[] = $foto->store('budidaya/galeri', 'public'); + } + $validated['galeri_gambar'] = $galeri; + } + + // Handle tags + $tagsDecoded = json_decode($request->tags, true); + $validated['tags'] = (!empty($tagsDecoded)) ? $tagsDecoded : null; + + if ($validated['is_published'] && !$artikelBudidaya->published_at) { + $validated['published_at'] = now(); + } + + $artikelBudidaya->update($validated); + + return redirect()->route('admin.artikel-budidaya.index') + ->with('success', 'Artikel budidaya berhasil diupdate!'); + } + + public function destroy(InformasiBudidaya $artikelBudidaya) + { + $artikelBudidaya->delete(); + return redirect()->route('admin.artikel-budidaya.index') + ->with('success', 'Artikel budidaya berhasil dihapus!'); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Admin/ArtikelController.php b/app/Http/Controllers/Admin/ArtikelController.php deleted file mode 100644 index 4dd8fe5..0000000 --- a/app/Http/Controllers/Admin/ArtikelController.php +++ /dev/null @@ -1,146 +0,0 @@ -get()->map(function($item) { - $item->kategori = 'Budidaya'; - return $item; - }); - - $hamaPenyakit = InformasiHamaPenyakit::latest()->get()->map(function($item) { - $item->kategori = 'Hama & Penyakit'; - return $item; - }); - - // Gabungkan dan paginate manual - $artikels = $budidaya->merge($hamaPenyakit)->sortByDesc('created_at'); - - // Convert ke paginator - $page = request()->get('page', 1); - $perPage = 10; - $artikels = new \Illuminate\Pagination\LengthAwarePaginator( - $artikels->forPage($page, $perPage), - $artikels->count(), - $perPage, - $page, - ['path' => request()->url(), 'query' => request()->query()] - ); - - return view('admin.artikel.index', compact('artikels')); - } - - /** - * Show the form for creating a new artikel. - */ - public function create() - { - return view('admin.artikel.create'); - } - - /** - * Store a newly created artikel. - */ - public function store(Request $request) - { - $validated = $request->validate([ - 'kategori' => ['required', 'in:budidaya,hama_penyakit'], - 'judul' => ['required', 'string', 'max:255'], - 'konten' => ['required', 'string'], - 'gambar' => ['nullable', 'image', 'max:2048'], - ]); - - // Upload gambar jika ada - if ($request->hasFile('gambar')) { - $validated['gambar'] = $request->file('gambar')->store('artikel', 'public'); - } - - $validated['created_by'] = auth()->id(); - - // Simpan ke tabel yang sesuai - if ($validated['kategori'] === 'budidaya') { - InformasiBudidaya::create($validated); - } else { - InformasiHamaPenyakit::create($validated); - } - - return redirect()->route('admin.artikel.index') - ->with('success', 'Artikel berhasil ditambahkan!'); - } - - /** - * Show the form for editing artikel. - */ - public function edit($id) - { - // Cari di kedua tabel - $artikel = InformasiBudidaya::find($id); - $kategori = 'budidaya'; - - if (!$artikel) { - $artikel = InformasiHamaPenyakit::findOrFail($id); - $kategori = 'hama_penyakit'; - } - - return view('admin.artikel.edit', compact('artikel', 'kategori')); - } - - /** - * Update the specified artikel. - */ - public function update(Request $request, $id) - { - $validated = $request->validate([ - 'kategori' => ['required', 'in:budidaya,hama_penyakit'], - 'judul' => ['required', 'string', 'max:255'], - 'konten' => ['required', 'string'], - 'gambar' => ['nullable', 'image', 'max:2048'], - ]); - - // Upload gambar baru jika ada - if ($request->hasFile('gambar')) { - $validated['gambar'] = $request->file('gambar')->store('artikel', 'public'); - } - - // Update di tabel yang sesuai - if ($validated['kategori'] === 'budidaya') { - $artikel = InformasiBudidaya::findOrFail($id); - } else { - $artikel = InformasiHamaPenyakit::findOrFail($id); - } - - $artikel->update($validated); - - return redirect()->route('admin.artikel.index') - ->with('success', 'Artikel berhasil diupdate!'); - } - - /** - * Remove the specified artikel. - */ - public function destroy($id) - { - // Coba hapus dari kedua tabel - $deleted = InformasiBudidaya::where('id', $id)->delete(); - - if (!$deleted) { - InformasiHamaPenyakit::where('id', $id)->delete(); - } - - return redirect()->route('admin.artikel.index') - ->with('success', 'Artikel berhasil dihapus!'); - } -} \ No newline at end of file diff --git a/app/Http/Controllers/Admin/ArtikelHamaPenyakitController.php b/app/Http/Controllers/Admin/ArtikelHamaPenyakitController.php new file mode 100644 index 0000000..ce7ddbe --- /dev/null +++ b/app/Http/Controllers/Admin/ArtikelHamaPenyakitController.php @@ -0,0 +1,139 @@ +paginate(10); + return view('admin.artikel-hama-penyakit.index', compact('artikels')); + } + + public function create() + { + return view('admin.artikel-hama-penyakit.create'); + } + + public function store(Request $request) + { + $validated = $request->validate([ + 'judul' => 'required|string|max:200', + 'jenis' => 'required|in:Hama,Penyakit', + 'deskripsi_singkat'=> 'nullable|string', + 'konten' => 'required|string', + 'gejala_visual' => 'nullable|string', + 'cara_identifikasi'=> 'nullable|string', + 'pencegahan' => 'nullable|string', + 'pengendalian' => 'nullable|string', + 'gambar_utama' => 'nullable|image|max:2048', + 'galeri_gambar.*' => 'nullable|image|max:2048', + 'file_pdf' => 'nullable|mimes:pdf|max:5120', + 'tags' => 'nullable|string', + 'is_published' => 'boolean', + ]); + + $validated['slug'] = Str::slug($request->judul); + $validated['created_by'] = auth()->id(); + $validated['is_published'] = $request->has('is_published') ? 1 : 0; + + if ($request->hasFile('gambar_utama')) { + $validated['gambar_utama'] = $request->file('gambar_utama')->store('hama-penyakit/gambar', 'public'); + } + + if ($request->hasFile('file_pdf')) { + $validated['file_pdf'] = $request->file('file_pdf')->store('hama-penyakit/pdf', 'public'); + } + + // Handle galeri gambar + if ($request->hasFile('galeri_gambar')) { + $galeri = []; + foreach ($request->file('galeri_gambar') as $foto) { + $galeri[] = $foto->store('hama-penyakit/galeri', 'public'); + } + $validated['galeri_gambar'] = $galeri; + } + + // Handle tags + $tagsDecoded = json_decode($request->tags, true); + $validated['tags'] = (!empty($tagsDecoded)) ? $tagsDecoded : null; + + if ($validated['is_published']) { + $validated['published_at'] = now(); + } + + InformasiHamaPenyakit::create($validated); + + return redirect()->route('admin.artikel-hama-penyakit.index') + ->with('success', 'Artikel hama & penyakit berhasil ditambahkan!'); + } + + public function edit(InformasiHamaPenyakit $artikelHamaPenyakit) + { + return view('admin.artikel-hama-penyakit.edit', compact('artikelHamaPenyakit')); + } + + public function update(Request $request, InformasiHamaPenyakit $artikelHamaPenyakit) + { + $validated = $request->validate([ + 'judul' => 'required|string|max:200', + 'jenis' => 'required|in:Hama,Penyakit', + 'deskripsi_singkat'=> 'nullable|string', + 'konten' => 'required|string', + 'gejala_visual' => 'nullable|string', + 'cara_identifikasi'=> 'nullable|string', + 'pencegahan' => 'nullable|string', + 'pengendalian' => 'nullable|string', + 'gambar_utama' => 'nullable|image|max:2048', + 'galeri_gambar.*' => 'nullable|image|max:2048', + 'file_pdf' => 'nullable|mimes:pdf|max:5120', + 'tags' => 'nullable|string', + 'is_published' => 'boolean', + ]); + + $validated['slug'] = Str::slug($request->judul); + $validated['is_published'] = $request->has('is_published') ? 1 : 0; + + if ($request->hasFile('gambar_utama')) { + $validated['gambar_utama'] = $request->file('gambar_utama')->store('hama-penyakit/gambar', 'public'); + } + + if ($request->hasFile('file_pdf')) { + $validated['file_pdf'] = $request->file('file_pdf')->store('hama-penyakit/pdf', 'public'); + } + + // Handle galeri gambar + if ($request->hasFile('galeri_gambar')) { + $galeri = []; + foreach ($request->file('galeri_gambar') as $foto) { + $galeri[] = $foto->store('hama-penyakit/galeri', 'public'); + } + $validated['galeri_gambar'] = $galeri; + } + + // Handle tags + $tagsDecoded = json_decode($request->tags, true); + $validated['tags'] = (!empty($tagsDecoded)) ? $tagsDecoded : null; + + if ($validated['is_published'] && !$artikelHamaPenyakit->published_at) { + $validated['published_at'] = now(); + } + + $artikelHamaPenyakit->update($validated); + + return redirect()->route('admin.artikel-hama-penyakit.index') + ->with('success', 'Artikel hama & penyakit berhasil diupdate!'); + } + + public function destroy(InformasiHamaPenyakit $artikelHamaPenyakit) + { + $artikelHamaPenyakit->delete(); + return redirect()->route('admin.artikel-hama-penyakit.index') + ->with('success', 'Artikel hama & penyakit berhasil dihapus!'); + } +} \ No newline at end of file diff --git a/app/Http/Controllers/Admin/RuleBasisController.php b/app/Http/Controllers/Admin/RuleBasisController.php index 5398ce7..b2afffe 100644 --- a/app/Http/Controllers/Admin/RuleBasisController.php +++ b/app/Http/Controllers/Admin/RuleBasisController.php @@ -34,7 +34,7 @@ public function index(Request $request) $rules = $query->orderBy('id_penyakit', 'asc') ->orderBy('id_gejala', 'asc') - ->paginate(15); + ->paginate(10); // Statistics $totalRules = RuleBasis::count(); diff --git a/app/Models/InformasiBudidaya.php b/app/Models/InformasiBudidaya.php index 8490522..2d64301 100644 --- a/app/Models/InformasiBudidaya.php +++ b/app/Models/InformasiBudidaya.php @@ -16,7 +16,6 @@ class InformasiBudidaya extends Model 'gambar_utama', 'galeri_gambar', 'file_pdf', - 'kategori', 'tags', 'urutan', 'is_published', diff --git a/database/migrations/2026_02_15_102443_fix_penyakit_foreign_key.php b/database/migrations/2026_02_15_102443_fix_penyakit_foreign_key.php index de386cd..cb41b44 100644 --- a/database/migrations/2026_02_15_102443_fix_penyakit_foreign_key.php +++ b/database/migrations/2026_02_15_102443_fix_penyakit_foreign_key.php @@ -12,43 +12,35 @@ */ public function up(): void { - // Step 1: Drop foreign key constraint sementara + // Step 1: Drop foreign key dulu + $fk1 = DB::select("SELECT CONSTRAINT_NAME FROM information_schema.TABLE_CONSTRAINTS + WHERE TABLE_SCHEMA = DATABASE() AND TABLE_NAME = 'riwayat_diagnosis' + AND CONSTRAINT_NAME = 'riwayat_diagnosis_penyakit_final_foreign' + AND CONSTRAINT_TYPE = 'FOREIGN KEY'"); + if (!empty($fk1)) { + Schema::table('riwayat_diagnosis', function (Blueprint $table) { + $table->dropForeign('riwayat_diagnosis_penyakit_final_foreign'); + }); + } + + // Step 2: Ubah penyakit_final jadi VARCHAR(10) supaya cocok dengan id_penyakit + DB::statement('ALTER TABLE riwayat_diagnosis MODIFY penyakit_final VARCHAR(10) NULL'); + + // Step 3: Pasang foreign key lagi + Schema::table('riwayat_diagnosis', function (Blueprint $table) { + $table->foreign('penyakit_final') + ->references('id_penyakit') + ->on('master_penyakit') + ->onDelete('set null'); + }); + } + + public function down(): void + { Schema::table('riwayat_diagnosis', function (Blueprint $table) { $table->dropForeign('riwayat_diagnosis_penyakit_final_foreign'); }); - // Step 2: Set id_penyakit jadi AUTO_INCREMENT - DB::statement('ALTER TABLE master_penyakit MODIFY id_penyakit BIGINT UNSIGNED NOT NULL AUTO_INCREMENT'); - - // Step 3: Ubah penyakit_final dari VARCHAR(10) jadi BIGINT UNSIGNED DB::statement('ALTER TABLE riwayat_diagnosis MODIFY penyakit_final BIGINT UNSIGNED NULL'); - - // Step 4: Buat foreign key lagi dengan tipe data yang benar - Schema::table('riwayat_diagnosis', function (Blueprint $table) { - $table->foreign('penyakit_final') - ->references('id_penyakit') - ->on('master_penyakit') - ->onDelete('set null'); - }); - } - - /** - * Reverse the migrations. - */ - public function down(): void - { - // Rollback: Drop foreign key - Schema::table('riwayat_diagnosis', function (Blueprint $table) { - $table->dropForeign(['penyakit_final']); - }); - - // Kembalikan penyakit_final jadi VARCHAR(10) - DB::statement('ALTER TABLE riwayat_diagnosis MODIFY penyakit_final VARCHAR(10) NULL'); - - // Hapus AUTO_INCREMENT dari id_penyakit - DB::statement('ALTER TABLE master_penyakit MODIFY id_penyakit BIGINT UNSIGNED NOT NULL'); - - // Buat foreign key lagi ke kode_penyakit (struktur lama) - // Note: Ini opsional, sesuaikan dengan struktur database awal kamu } }; \ No newline at end of file diff --git a/database/migrations/2026_02_26_130318_remove_kategori_from_informasi_budidaya_table.php b/database/migrations/2026_02_26_130318_remove_kategori_from_informasi_budidaya_table.php new file mode 100644 index 0000000..ebe21be --- /dev/null +++ b/database/migrations/2026_02_26_130318_remove_kategori_from_informasi_budidaya_table.php @@ -0,0 +1,25 @@ +dropColumn('kategori'); + }); + } + + public function down(): void + { + Schema::table('informasi_budidaya', function (Blueprint $table) { + $table->string('kategori', 50)->nullable(); + }); + } +}; diff --git a/resources/views/admin/artikel-budidaya/create.blade.php b/resources/views/admin/artikel-budidaya/create.blade.php new file mode 100644 index 0000000..987ac03 --- /dev/null +++ b/resources/views/admin/artikel-budidaya/create.blade.php @@ -0,0 +1,133 @@ +@extends('layouts.admin-app') + +@section('page-title', 'Tambah Artikel Budidaya') +@section('page-subtitle', 'Tambah informasi budidaya kopi baru') + +@section('content') +
+
+
+ @csrf + +
+ +
+ + + @error('judul')

{{ $message }}

@enderror +
+ + +
+ + +
+ + +
+ + + @error('konten')

{{ $message }}

@enderror +
+ + +
+
+ + +

Format: JPG, PNG. Maks 2MB

+
+
+ + +

Format: PDF. Maks 5MB

+
+
+ + +
+ +
+
+ +

Tekan Enter atau koma untuk menambah tag

+ +
+ + +
+ + +

Bisa pilih beberapa foto sekaligus. Format: JPG, PNG. Maks 2MB per foto

+
+ + +
+ + +
+
+ + +
+ + Batal + + +
+
+
+
+@endsection + +@push('scripts') + +@endpush \ No newline at end of file diff --git a/resources/views/admin/artikel-budidaya/edit.blade.php b/resources/views/admin/artikel-budidaya/edit.blade.php new file mode 100644 index 0000000..1fbef66 --- /dev/null +++ b/resources/views/admin/artikel-budidaya/edit.blade.php @@ -0,0 +1,148 @@ +@extends('layouts.admin-app') + +@section('page-title', 'Edit Artikel Budidaya') +@section('page-subtitle', 'Edit informasi budidaya kopi') + +@section('content') +
+
+
+ @csrf + @method('PUT') + +
+ +
+ + + @error('judul')

{{ $message }}

@enderror +
+ + +
+ + +
+ + +
+ + + @error('konten')

{{ $message }}

@enderror +
+ + +
+
+ + @if($artikelBudidaya->gambar_utama) + + @endif + +

Kosongkan jika tidak ingin mengubah gambar

+
+
+ + @if($artikelBudidaya->file_pdf) + Lihat PDF saat ini + @endif + +

Kosongkan jika tidak ingin mengubah PDF

+
+
+ + +
+ +
+
+ +

Tekan Enter atau koma untuk menambah tag

+ +
+ + +
+ + @if($artikelBudidaya->galeri_gambar) +
+ @foreach($artikelBudidaya->galeri_gambar as $foto) + + @endforeach +
+ @endif + +

Upload foto baru akan menggantikan galeri yang lama

+
+ +
+ is_published) ? 'checked' : '' }} + class="w-5 h-5 text-green-600 rounded focus:ring-green-500"> + +
+
+ + +
+ + Batal + + +
+
+
+
+@endsection + +@push('scripts') + +@endpush \ No newline at end of file diff --git a/resources/views/admin/artikel/index.blade.php b/resources/views/admin/artikel-budidaya/index.blade.php similarity index 71% rename from resources/views/admin/artikel/index.blade.php rename to resources/views/admin/artikel-budidaya/index.blade.php index 9abbd9e..28eb563 100644 --- a/resources/views/admin/artikel/index.blade.php +++ b/resources/views/admin/artikel-budidaya/index.blade.php @@ -1,7 +1,7 @@ @extends('layouts.admin-app') -@section('page-title', '📰 Manajemen Artikel') -@section('page-subtitle', 'Kelola artikel edukasi') +@section('page-title', 'Artikel Budidaya') +@section('page-subtitle', 'Kelola informasi budidaya kopi') @section('content') @if (session('success')) @@ -17,14 +17,14 @@
-
+
-

Daftar Artikel Edukasi

+

Daftar Artikel Budidaya

- + @@ -38,7 +38,7 @@ No Judul - Kategori + Status Penulis Tanggal Aksi @@ -50,23 +50,28 @@ {{ $artikels->firstItem() + $index }}
{{ $artikel->judul }}
+ @if($artikel->deskripsi_singkat) +
{{ Str::limit($artikel->deskripsi_singkat, 60) }}
+ @endif - - {{ $artikel->kategori }} - + @if($artikel->is_published) + Published + @else + Draft + @endif - {{ $artikel->penulis ?? 'Admin' }} + {{ $artikel->author->nama ?? 'Admin' }} {{ $artikel->created_at->format('d M Y') }}
- + Edit -
+ @csrf @method('DELETE') +
+ +
+
+@endsection + +@push('scripts') + +@endpush \ No newline at end of file diff --git a/resources/views/admin/artikel-hama-penyakit/edit.blade.php b/resources/views/admin/artikel-hama-penyakit/edit.blade.php new file mode 100644 index 0000000..4d6b2f0 --- /dev/null +++ b/resources/views/admin/artikel-hama-penyakit/edit.blade.php @@ -0,0 +1,186 @@ +@extends('layouts.admin-app') + +@section('page-title', 'Edit Artikel Hama & Penyakit') +@section('page-subtitle', 'Edit informasi hama dan penyakit kopi') + +@section('content') +
+
+
+ @csrf + @method('PUT') + +
+ +
+
+ + + @error('judul')

{{ $message }}

@enderror +
+
+ + +
+
+ + +
+ + +
+ + +
+ + + @error('konten')

{{ $message }}

@enderror +
+ + +
+

📋 Informasi Teknis

+
+
+ + +
+
+ + +
+
+
+ + +
+
+ + +
+
+
+
+ + +
+
+ + @if($artikelHamaPenyakit->gambar_utama) + + @endif + +

Kosongkan jika tidak ingin mengubah

+
+
+ + @if($artikelHamaPenyakit->file_pdf) + Lihat PDF saat ini + @endif + +

Kosongkan jika tidak ingin mengubah

+
+
+ + +
+ +
+ +

Tekan Enter atau koma untuk menambah tag

+ +
+ + +
+ + @if($artikelHamaPenyakit->galeri_gambar) +
+ @foreach($artikelHamaPenyakit->galeri_gambar as $foto) + + @endforeach +
+ @endif + +

Upload foto baru akan menggantikan galeri yang lama

+
+ + +
+ is_published) ? 'checked' : '' }} + class="w-5 h-5 text-red-600 rounded focus:ring-red-500"> + +
+
+ + +
+ + Batal + + +
+
+
+
+@endsection + +@push('scripts') + +@endpush \ No newline at end of file diff --git a/resources/views/admin/artikel-hama-penyakit/index.blade.php b/resources/views/admin/artikel-hama-penyakit/index.blade.php new file mode 100644 index 0000000..1acdca1 --- /dev/null +++ b/resources/views/admin/artikel-hama-penyakit/index.blade.php @@ -0,0 +1,110 @@ +@extends('layouts.admin-app') + +@section('page-title', 'Artikel Hama & Penyakit') +@section('page-subtitle', 'Kelola informasi hama dan penyakit kopi') + +@section('content') + @if (session('success')) +
+ + + + {{ session('success') }} +
+ @endif + +
+
+
+
+
+ + + +
+

Daftar Artikel Hama & Penyakit

+
+ + + + + Tambah Artikel + +
+ +
+ + + + + + + + + + + + + @forelse ($artikels as $index => $artikel) + + + + + + + + + @empty + + + + @endforelse + +
NoJudulJenisStatusTanggalAksi
{{ $artikels->firstItem() + $index }} +
{{ $artikel->judul }}
+ @if($artikel->deskripsi_singkat) +
{{ Str::limit($artikel->deskripsi_singkat, 60) }}
+ @endif +
+ @if($artikel->jenis === 'Hama') + Hama + @else + Penyakit + @endif + + @if($artikel->is_published) + Published + @else + Draft + @endif + {{ $artikel->created_at->format('d M Y') }} +
+ + + + + Edit + +
+ @csrf + @method('DELETE') + +
+
+
+ + + +

Belum ada artikel hama & penyakit

+
+
+ +
{{ $artikels->links() }}
+
+
+@endsection \ No newline at end of file diff --git a/resources/views/admin/rule-basis/create.blade.php b/resources/views/admin/rule-basis/create.blade.php index 3f2ec3f..052cbad 100644 --- a/resources/views/admin/rule-basis/create.blade.php +++ b/resources/views/admin/rule-basis/create.blade.php @@ -1,6 +1,6 @@ @extends('layouts.admin-app') -@section('page-title', '➕ Tambah Rule Basis') +@section('page-title', 'Tambah Rule Basis') @section('page-subtitle', 'Tambah aturan diagnosa baru') @section('content') diff --git a/resources/views/admin/rule-basis/edit.blade.php b/resources/views/admin/rule-basis/edit.blade.php index 1547dca..72dadc4 100644 --- a/resources/views/admin/rule-basis/edit.blade.php +++ b/resources/views/admin/rule-basis/edit.blade.php @@ -1,6 +1,6 @@ @extends('layouts.admin-app') -@section('page-title', '✏️ Edit Rule Basis') +@section('page-title', 'Edit Rule Basis') @section('page-subtitle', 'Edit aturan diagnosa') @section('content') diff --git a/resources/views/admin/rule-basis/index.blade.php b/resources/views/admin/rule-basis/index.blade.php index 5c3bf5e..4cc4db1 100644 --- a/resources/views/admin/rule-basis/index.blade.php +++ b/resources/views/admin/rule-basis/index.blade.php @@ -1,6 +1,6 @@ @extends('layouts.admin-app') -@section('page-title', '🧠 Manajemen Rule Basis') +@section('page-title', 'Manajemen Rule Basis') @section('page-subtitle', 'Kelola aturan diagnosa sistem pakar') @section('content') diff --git a/resources/views/layouts/admin-app.blade.php b/resources/views/layouts/admin-app.blade.php index aa7c3f1..79d4992 100644 --- a/resources/views/layouts/admin-app.blade.php +++ b/resources/views/layouts/admin-app.blade.php @@ -198,18 +198,48 @@ class="menu-item flex items-center px-4 py-3 rounded-xl hover:bg-gray-700 {{ req
- - -
-
- - - + +
+ + + + + + - +
diff --git a/routes/web.php b/routes/web.php index c905e8a..4ff79a5 100644 --- a/routes/web.php +++ b/routes/web.php @@ -3,11 +3,12 @@ use App\Http\Controllers\ProfileController; use Illuminate\Support\Facades\Route; use App\Http\Controllers\SuperAdmin\UserManagementController; -use App\Http\Controllers\Admin\AdminDashboardController; // ← TAMBAHKAN INI -use App\Http\Controllers\Admin\PenyakitController; // ← DAN INI +use App\Http\Controllers\Admin\AdminDashboardController; +use App\Http\Controllers\Admin\PenyakitController; use App\Http\Controllers\Admin\GejalaController; -use App\Http\Controllers\Admin\RuleBasisController; // ← DAN INI -use App\Http\Controllers\Admin\ArtikelController; // ← DAN INI +use App\Http\Controllers\Admin\RuleBasisController; +use App\Http\Controllers\Admin\ArtikelBudidayaController; +use App\Http\Controllers\Admin\ArtikelHamaPenyakitController; Route::get('/', function () { return view('welcome'); @@ -55,11 +56,9 @@ ]); // Artikel Management - Route::resource('artikel', ArtikelController::class); + Route::resource('artikel-budidaya', ArtikelBudidayaController::class); + Route::resource('artikel-hama-penyakit', ArtikelHamaPenyakitController::class); - // Bisa tambah route lain di sini: - // Route::resource('diagnosa', DiagnosaController::class); - // Route::resource('aturan', AturanController::class); }); // Profile Routes