perbaikan database
This commit is contained in:
parent
9df3b3403d
commit
d8df50a853
|
|
@ -7,6 +7,7 @@
|
||||||
class AduanTps extends Model
|
class AduanTps extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'aduan_tps';
|
protected $table = 'aduan_tps';
|
||||||
|
protected $primaryKey = 'id_aduan';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'lokasi_tps_id',
|
'lokasi_tps_id',
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
class KategoriTps extends Model
|
class KategoriTps extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'kategori_tps';
|
protected $table = 'kategori_tps';
|
||||||
|
protected $primaryKey = 'id_kategori_tps';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'nama_kategori',
|
'nama_kategori',
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ class LokasiTps extends Model
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
protected $table = 'lokasi_tps';
|
protected $table = 'lokasi_tps';
|
||||||
|
protected $primaryKey = 'id_tps';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'kategori_tps_id',
|
'kategori_tps_id',
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@
|
||||||
class Sampah extends Model
|
class Sampah extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'sampah';
|
protected $table = 'sampah';
|
||||||
|
protected $primaryKey = 'id_sampah';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'user_id',
|
'user_id',
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,10 @@ class User extends Authenticatable
|
||||||
use Notifiable;
|
use Notifiable;
|
||||||
|
|
||||||
protected $table = 'users';
|
protected $table = 'users';
|
||||||
|
protected $primaryKey = 'id_users';
|
||||||
|
|
||||||
|
public $incrementing = true;
|
||||||
|
protected $keyType = 'int';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
'name',
|
'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>
|
<h4 class="card-title">Edit Kategori TPS</h4>
|
||||||
<p class="card-description">Form edit data kategori TPS</p>
|
<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">
|
enctype="multipart/form-data">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
|
|
|
||||||
|
|
@ -46,11 +46,11 @@
|
||||||
</td>
|
</td>
|
||||||
<td>{{ $item->deskripsi ?? '-' }}</td>
|
<td>{{ $item->deskripsi ?? '-' }}</td>
|
||||||
<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">
|
class="btn btn-warning btn-sm me-1" title="Edit">
|
||||||
<i class="bi bi-pencil-square"></i>
|
<i class="bi bi-pencil-square"></i>
|
||||||
</a>
|
</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;">
|
class="form-hapus" style="display:inline;">
|
||||||
@csrf
|
@csrf
|
||||||
@method('DELETE')
|
@method('DELETE')
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
Form edit data sampah per tahun (satuan Ton)
|
Form edit data sampah per tahun (satuan Ton)
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<form action="{{ route('admin.sampah.update', $sampah->id) }}" method="POST">
|
<form action="{{ route('admin.sampah.update', $sampah->id_sampah) }}" method="POST">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -45,12 +45,12 @@
|
||||||
<td>{{ $item->total_daur_ulang }}</td>
|
<td>{{ $item->total_daur_ulang }}</td>
|
||||||
<td>{{ $item->sisa_sampah }}</td>
|
<td>{{ $item->sisa_sampah }}</td>
|
||||||
<td class="text-center">
|
<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">
|
class="btn btn-warning btn-sm me-1">
|
||||||
<i class="bi bi-pencil-square"></i>
|
<i class="bi bi-pencil-square"></i>
|
||||||
</a>
|
</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;">
|
class="form-hapus" style="display:inline;">
|
||||||
@csrf
|
@csrf
|
||||||
@method('DELETE')
|
@method('DELETE')
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,7 @@
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ route('admin.kategori.index') }}">
|
<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>
|
<span class="menu-title">Kategori TPS</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
@ -93,6 +93,12 @@
|
||||||
<span class="menu-title">Kelola Sampah</span>
|
<span class="menu-title">Kelola Sampah</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</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>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,7 @@
|
||||||
Form edit data Tempat Pembuangan Sampah
|
Form edit data Tempat Pembuangan Sampah
|
||||||
</p>
|
</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">
|
class="forms-sample">
|
||||||
@csrf
|
@csrf
|
||||||
@method('PUT')
|
@method('PUT')
|
||||||
|
|
|
||||||
|
|
@ -70,12 +70,12 @@
|
||||||
|
|
||||||
<!-- AKSI -->
|
<!-- AKSI -->
|
||||||
<td class="text-center">
|
<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">
|
class="btn btn-warning btn-sm me-1">
|
||||||
<i class="bi bi-pencil-square"></i>
|
<i class="bi bi-pencil-square"></i>
|
||||||
</a>
|
</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;">
|
class="form-hapus" style="display:inline;">
|
||||||
@csrf
|
@csrf
|
||||||
@method('DELETE')
|
@method('DELETE')
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue