perbaikan database
This commit is contained in:
parent
9df3b3403d
commit
d8df50a853
|
|
@ -7,6 +7,7 @@
|
|||
class AduanTps extends Model
|
||||
{
|
||||
protected $table = 'aduan_tps';
|
||||
protected $primaryKey = 'id_aduan';
|
||||
|
||||
protected $fillable = [
|
||||
'lokasi_tps_id',
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
class KategoriTps extends Model
|
||||
{
|
||||
protected $table = 'kategori_tps';
|
||||
protected $primaryKey = 'id_kategori_tps';
|
||||
|
||||
protected $fillable = [
|
||||
'nama_kategori',
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ class LokasiTps extends Model
|
|||
use HasFactory;
|
||||
|
||||
protected $table = 'lokasi_tps';
|
||||
protected $primaryKey = 'id_tps';
|
||||
|
||||
protected $fillable = [
|
||||
'kategori_tps_id',
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
class Sampah extends Model
|
||||
{
|
||||
protected $table = 'sampah';
|
||||
protected $primaryKey = 'id_sampah';
|
||||
|
||||
protected $fillable = [
|
||||
'user_id',
|
||||
|
|
|
|||
|
|
@ -10,6 +10,10 @@ class User extends Authenticatable
|
|||
use Notifiable;
|
||||
|
||||
protected $table = 'users';
|
||||
protected $primaryKey = 'id_users';
|
||||
|
||||
public $incrementing = true;
|
||||
protected $keyType = 'int';
|
||||
|
||||
protected $fillable = [
|
||||
'name',
|
||||
|
|
|
|||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
if (!Schema::hasColumn('aduan_tps', 'alamat_pelapor')) {
|
||||
Schema::table('aduan_tps', function (Blueprint $table) {
|
||||
$table->string('alamat_pelapor')->after('nama_pelapor');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
if (Schema::hasColumn('aduan_tps', 'alamat_pelapor')) {
|
||||
Schema::table('aduan_tps', function (Blueprint $table) {
|
||||
$table->dropColumn('alamat_pelapor');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->renameColumn('id', 'id_users');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->renameColumn('id_users', 'id');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,21 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('lokasi_tps', function (Blueprint $table) {
|
||||
$table->renameColumn('id', 'id_lokasi_tps');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('lokasi_tps', function (Blueprint $table) {
|
||||
$table->renameColumn('id_lokasi_tps', 'id');
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
if (
|
||||
Schema::hasColumn('lokasi_tps', 'id_lokasi_tps') &&
|
||||
!Schema::hasColumn('lokasi_tps', 'id_tps')
|
||||
) {
|
||||
Schema::table('lokasi_tps', function (Blueprint $table) {
|
||||
$table->renameColumn('id_lokasi_tps', 'id_tps');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,25 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration {
|
||||
|
||||
public function up(): void
|
||||
{
|
||||
if (
|
||||
Schema::hasColumn('kategori_tps', 'id') &&
|
||||
!Schema::hasColumn('kategori_tps', 'id_kategori_tps')
|
||||
) {
|
||||
Schema::table('kategori_tps', function (Blueprint $table) {
|
||||
$table->renameColumn('id', 'id_kategori_tps');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (
|
||||
Schema::hasColumn('sampah', 'id') &&
|
||||
!Schema::hasColumn('sampah', 'id_sampah')
|
||||
) {
|
||||
Schema::table('sampah', function (Blueprint $table) {
|
||||
$table->renameColumn('id', 'id_sampah');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('sampah', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -0,0 +1,33 @@
|
|||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (
|
||||
Schema::hasColumn('aduan_tps', 'id') &&
|
||||
!Schema::hasColumn('aduan_tps', 'id_aduan')
|
||||
) {
|
||||
Schema::table('aduan_tps', function (Blueprint $table) {
|
||||
$table->renameColumn('id', 'id_aduan');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('aduan_tps', function (Blueprint $table) {
|
||||
//
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
@ -9,7 +9,7 @@
|
|||
<h4 class="card-title">Edit Kategori TPS</h4>
|
||||
<p class="card-description">Form edit data kategori TPS</p>
|
||||
|
||||
<form action="{{ route('admin.kategori.update', $kategori->id) }}" method="POST"
|
||||
<form action="{{ route('admin.kategori.update', $kategori->id_kategori_tps) }}" method="POST"
|
||||
enctype="multipart/form-data">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
|
|
|||
|
|
@ -46,11 +46,11 @@
|
|||
</td>
|
||||
<td>{{ $item->deskripsi ?? '-' }}</td>
|
||||
<td>
|
||||
<a href="{{ route('admin.kategori.edit', $item->id) }}"
|
||||
<a href="{{ route('admin.kategori.edit', $item->id_kategori_tps) }}"
|
||||
class="btn btn-warning btn-sm me-1" title="Edit">
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</a>
|
||||
<form action="{{ route('admin.tps.destroy', $item->id) }}" method="POST"
|
||||
<form action="{{ route('admin.tps.destroy', $item->id_kategori_tps) }}" method="POST"
|
||||
class="form-hapus" style="display:inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
Form edit data sampah per tahun (satuan Ton)
|
||||
</p>
|
||||
|
||||
<form action="{{ route('admin.sampah.update', $sampah->id) }}" method="POST">
|
||||
<form action="{{ route('admin.sampah.update', $sampah->id_sampah) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
||||
|
|
|
|||
|
|
@ -45,12 +45,12 @@
|
|||
<td>{{ $item->total_daur_ulang }}</td>
|
||||
<td>{{ $item->sisa_sampah }}</td>
|
||||
<td class="text-center">
|
||||
<a href="{{ route('admin.sampah.edit', $item->id) }}"
|
||||
<a href="{{ route('admin.sampah.edit', $item->id_sampah) }}"
|
||||
class="btn btn-warning btn-sm me-1">
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</a>
|
||||
|
||||
<form action="{{ route('admin.sampah.destroy', $item->id) }}" method="POST"
|
||||
<form action="{{ route('admin.sampah.destroy', $item->id_sampah) }}" method="POST"
|
||||
class="form-hapus" style="display:inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
|
|
|
|||
|
|
@ -83,7 +83,7 @@
|
|||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('admin.kategori.index') }}">
|
||||
<i class="icon-paper menu-icon"></i>
|
||||
<i class="icon-bell menu-icon"></i>
|
||||
<span class="menu-title">Kategori TPS</span>
|
||||
</a>
|
||||
</li>
|
||||
|
|
@ -93,6 +93,12 @@
|
|||
<span class="menu-title">Kelola Sampah</span>
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" href="{{ route('admin.sampah.index') }}">
|
||||
<i class="icon-paper menu-icon"></i>
|
||||
<span class="menu-title">Kelola Aduan</span>
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@
|
|||
Form edit data Tempat Pembuangan Sampah
|
||||
</p>
|
||||
|
||||
<form action="{{ route('admin.tps.update', $tps->id) }}" method="POST" enctype="multipart/form-data"
|
||||
<form action="{{ route('admin.tps.update', $tps->id_tps) }}" method="POST" enctype="multipart/form-data"
|
||||
class="forms-sample">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
|
|
|
|||
|
|
@ -70,12 +70,12 @@
|
|||
|
||||
<!-- AKSI -->
|
||||
<td class="text-center">
|
||||
<a href="{{ route('admin.tps.edit', $item->id) }}"
|
||||
<a href="{{ route('admin.tps.edit', $item->id_tps) }}"
|
||||
class="btn btn-warning btn-sm me-1">
|
||||
<i class="bi bi-pencil-square"></i>
|
||||
</a>
|
||||
|
||||
<form action="{{ route('admin.tps.destroy', $item->id) }}" method="POST"
|
||||
<form action="{{ route('admin.tps.destroy', $item->id_tps) }}" method="POST"
|
||||
class="form-hapus" style="display:inline;">
|
||||
@csrf
|
||||
@method('DELETE')
|
||||
|
|
|
|||
Loading…
Reference in New Issue