diff --git a/backend/app/Http/Controllers/TemplateController.php b/backend/app/Http/Controllers/TemplateController.php index 577947a..c5e4085 100644 --- a/backend/app/Http/Controllers/TemplateController.php +++ b/backend/app/Http/Controllers/TemplateController.php @@ -26,7 +26,7 @@ class TemplateController extends Controller 'kategori_id' => 'required|exists:kategoris,id', 'fitur_id' => 'required|exists:fiturs,id', 'foto' => 'nullable|image|mimes:jpg,jpeg,png,gif|max:5120', - 'harga' => 'required|numeric', + 'harga' => 'required|numeric|min:0' ]); if ($request->hasFile('foto')) { @@ -44,7 +44,7 @@ class TemplateController extends Controller 'kategori_id' => 'required|exists:kategoris,id', 'fitur_id' => 'required|exists:fiturs,id', 'foto' => 'nullable|image|mimes:jpg,jpeg,png,gif|max:5120', - 'harga' => 'required|numeric', + 'harga' => 'required|numeric|min:0' ]); if ($request->hasFile('foto')) { @@ -77,6 +77,6 @@ class TemplateController extends Controller $kategoris = Kategori::all(); $fiturs = Fitur::all(); - return view('admin.templates.index', compact('templates', 'kategoris', 'fiturs', 'kategori', 'harga')); + return view('admin.templates.index', compact('templates', 'kategoris', 'fiturs', 'kategori')); } } diff --git a/backend/app/Models/Template.php b/backend/app/Models/Template.php index e1de704..03a7e6a 100644 --- a/backend/app/Models/Template.php +++ b/backend/app/Models/Template.php @@ -6,7 +6,7 @@ use Illuminate\Database\Eloquent\Model; class Template extends Model { - protected $fillable = ['nama_template', 'kategori_id', 'fitur_id', 'foto']; + protected $fillable = ['nama_template', 'kategori_id', 'fitur_id', 'foto', 'harga']; public function kategori() { return $this->belongsTo(Kategori::class); diff --git a/backend/database/migrations/2025_09_03_042108_create_templates_table.php b/backend/database/migrations/2025_09_03_042108_create_templates_table.php index 34594c7..f98c705 100644 --- a/backend/database/migrations/2025_09_03_042108_create_templates_table.php +++ b/backend/database/migrations/2025_09_03_042108_create_templates_table.php @@ -12,6 +12,7 @@ return new class extends Migration { $table->string('nama_template'); $table->foreignId('kategori_id')->constrained()->cascadeOnDelete(); $table->foreignId('fitur_id')->constrained()->cascadeOnDelete(); + $table->decimal('harga', 10, 2)->default(0); $table->string('foto')->nullable(); $table->timestamps(); }); diff --git a/backend/resources/views/admin/templates/index.blade.php b/backend/resources/views/admin/templates/index.blade.php index 922e2a3..ee12d49 100644 --- a/backend/resources/views/admin/templates/index.blade.php +++ b/backend/resources/views/admin/templates/index.blade.php @@ -3,102 +3,98 @@ @section('title', 'Manajemen Template') @section('content') -
No | +Nama Template | +Kategori | +Fitur | +Foto | +Harga | +Aksi | +
---|---|---|---|---|---|---|
No | -Nama Template | -Kategori | -Fitur | -Foto | -Aksi | -|
{{ $key + 1 }} | -{{ $template->nama_template }} | -{{ $template->kategori->nama ?? '-' }} | -{{ $template->fitur->deskripsi ?? '-' }} - | -
-
-
- ![]() |
-
-
- | |
Belum ada - template | -