fungsi crud kategori tps admin
This commit is contained in:
parent
f76c1fc2fa
commit
7be1b5d68e
|
|
@ -0,0 +1,94 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Http\Controllers\Admin;
|
||||||
|
|
||||||
|
use App\Http\Controllers\Controller;
|
||||||
|
use App\Models\KategoriTps;
|
||||||
|
use Illuminate\Http\Request;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
|
class KategoriTpsController extends Controller
|
||||||
|
{
|
||||||
|
public function index()
|
||||||
|
{
|
||||||
|
$title = 'Kategori TPS';
|
||||||
|
$kategori = KategoriTps::all();
|
||||||
|
|
||||||
|
return view('admin.kategori-tps.index', compact('title', 'kategori'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function create()
|
||||||
|
{
|
||||||
|
$title = 'Tambah Kategori TPS';
|
||||||
|
return view('admin.kategori-tps.create', compact('title'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function store(Request $request)
|
||||||
|
{
|
||||||
|
$data = $request->validate([
|
||||||
|
'nama_kategori' => 'required|string|max:100',
|
||||||
|
'deskripsi' => 'nullable|string',
|
||||||
|
'foto_kategori' => 'nullable|image|mimes:jpg,jpeg,png|max:2048'
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->hasFile('foto_kategori')) {
|
||||||
|
$data['foto_kategori'] = $request->file('foto_kategori')
|
||||||
|
->store('kategori', 'public');
|
||||||
|
}
|
||||||
|
|
||||||
|
KategoriTps::create($data);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('admin.kategori.index')
|
||||||
|
->with('success', 'Kategori berhasil ditambahkan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$title = 'Edit Kategori TPS';
|
||||||
|
$kategori = KategoriTps::findOrFail($id);
|
||||||
|
|
||||||
|
return view('admin.kategori-tps.edit', compact('title', 'kategori'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$kategori = KategoriTps::findOrFail($id);
|
||||||
|
|
||||||
|
$data = $request->validate([
|
||||||
|
'nama_kategori' => 'required|string|max:100',
|
||||||
|
'deskripsi' => 'nullable|string',
|
||||||
|
'foto_kategori' => 'nullable|image|mimes:jpg,jpeg,png|max:2048'
|
||||||
|
]);
|
||||||
|
|
||||||
|
if ($request->hasFile('foto_kategori')) {
|
||||||
|
if ($kategori->foto_kategori) {
|
||||||
|
Storage::disk('public')->delete($kategori->foto_kategori);
|
||||||
|
}
|
||||||
|
|
||||||
|
$data['foto_kategori'] = $request->file('foto_kategori')
|
||||||
|
->store('kategori', 'public');
|
||||||
|
}
|
||||||
|
|
||||||
|
$kategori->update($data);
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('admin.kategori.index')
|
||||||
|
->with('success', 'Kategori berhasil diperbarui');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$kategori = KategoriTps::findOrFail($id);
|
||||||
|
|
||||||
|
if ($kategori->foto_kategori) {
|
||||||
|
Storage::disk('public')->delete($kategori->foto_kategori);
|
||||||
|
}
|
||||||
|
|
||||||
|
$kategori->delete();
|
||||||
|
|
||||||
|
return redirect()
|
||||||
|
->route('admin.kategori.index')
|
||||||
|
->with('success', 'Kategori berhasil dihapus');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -4,22 +4,127 @@
|
||||||
|
|
||||||
use App\Http\Controllers\Controller;
|
use App\Http\Controllers\Controller;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
|
use App\Models\LokasiTps;
|
||||||
|
use App\Models\KategoriTps;
|
||||||
|
use Illuminate\Support\Facades\Storage;
|
||||||
|
|
||||||
class TpsController extends Controller
|
class TpsController extends Controller
|
||||||
{
|
{
|
||||||
public function index()
|
public function index()
|
||||||
{
|
{
|
||||||
$title = 'Tps Admin';
|
$title = 'Data TPS';
|
||||||
return view('admin.tps.index', compact('title'));
|
|
||||||
|
// Ambil TPS + kategori + jumlah aduan
|
||||||
|
$tps = LokasiTps::with('kategori')
|
||||||
|
->withCount('aduan')
|
||||||
|
->get();
|
||||||
|
|
||||||
|
return view('admin.tps.index', compact('title', 'tps'));
|
||||||
}
|
}
|
||||||
|
|
||||||
public function create()
|
public function create()
|
||||||
{
|
{
|
||||||
$title = 'Tambah Tps Admin';
|
$title = 'Tambah TPS';
|
||||||
return view('admin.tps.create', compact('title'));
|
$kategori = KategoriTps::all();
|
||||||
|
|
||||||
|
return view('admin.tps.create', compact('title', 'kategori'));
|
||||||
}
|
}
|
||||||
public function edit()
|
|
||||||
|
public function store(Request $request)
|
||||||
{
|
{
|
||||||
$title = 'Edit Tps Admin';
|
$request->validate([
|
||||||
return view('admin.tps.edit', compact('title'));
|
'kategori_tps_id' => 'required|exists:kategori_tps,id',
|
||||||
|
'nama_tps' => 'required|string|max:255',
|
||||||
|
'status_tps' => 'required',
|
||||||
|
'tahun_pembuatan' => 'required|numeric',
|
||||||
|
'kapasitas_tps' => 'required',
|
||||||
|
'latitude' => 'required',
|
||||||
|
'longitude' => 'required',
|
||||||
|
'foto_tps' => 'nullable|image|mimes:jpg,jpeg,png|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Upload foto
|
||||||
|
if ($request->hasFile('foto_tps')) {
|
||||||
|
$foto = $request->file('foto_tps')->store('foto-tps', 'public');
|
||||||
|
} else {
|
||||||
|
$foto = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
LokasiTps::create([
|
||||||
|
'kategori_tps_id' => $request->kategori_tps_id,
|
||||||
|
'nama_tps' => $request->nama_tps,
|
||||||
|
'status_tps' => $request->status_tps,
|
||||||
|
'tahun_pembuatan' => $request->tahun_pembuatan,
|
||||||
|
'kapasitas_tps' => $request->kapasitas_tps,
|
||||||
|
'latitude' => $request->latitude,
|
||||||
|
'longitude' => $request->longitude,
|
||||||
|
'foto_tps' => $foto,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('tps.index')
|
||||||
|
->with('success', 'Data TPS berhasil ditambahkan');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function edit($id)
|
||||||
|
{
|
||||||
|
$title = 'Edit TPS';
|
||||||
|
$tps = LokasiTps::findOrFail($id);
|
||||||
|
$kategori = KategoriTps::all();
|
||||||
|
|
||||||
|
return view('admin.tps.edit', compact('title', 'tps', 'kategori'));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function update(Request $request, $id)
|
||||||
|
{
|
||||||
|
$tps = LokasiTps::findOrFail($id);
|
||||||
|
|
||||||
|
$request->validate([
|
||||||
|
'kategori_tps_id' => 'required|exists:kategori_tps,id',
|
||||||
|
'nama_tps' => 'required|string|max:255',
|
||||||
|
'status_tps' => 'required',
|
||||||
|
'tahun_pembuatan' => 'required|numeric',
|
||||||
|
'kapasitas_tps' => 'required',
|
||||||
|
'latitude' => 'required',
|
||||||
|
'longitude' => 'required',
|
||||||
|
'foto_tps' => 'nullable|image|mimes:jpg,jpeg,png|max:2048',
|
||||||
|
]);
|
||||||
|
|
||||||
|
// Jika upload foto baru
|
||||||
|
if ($request->hasFile('foto_tps')) {
|
||||||
|
if ($tps->foto_tps) {
|
||||||
|
Storage::disk('public')->delete($tps->foto_tps);
|
||||||
|
}
|
||||||
|
$foto = $request->file('foto_tps')->store('foto-tps', 'public');
|
||||||
|
} else {
|
||||||
|
$foto = $tps->foto_tps;
|
||||||
|
}
|
||||||
|
|
||||||
|
$tps->update([
|
||||||
|
'kategori_tps_id' => $request->kategori_tps_id,
|
||||||
|
'nama_tps' => $request->nama_tps,
|
||||||
|
'status_tps' => $request->status_tps,
|
||||||
|
'tahun_pembuatan' => $request->tahun_pembuatan,
|
||||||
|
'kapasitas_tps' => $request->kapasitas_tps,
|
||||||
|
'latitude' => $request->latitude,
|
||||||
|
'longitude' => $request->longitude,
|
||||||
|
'foto_tps' => $foto,
|
||||||
|
]);
|
||||||
|
|
||||||
|
return redirect()->route('tps.index')
|
||||||
|
->with('success', 'Data TPS berhasil diperbarui');
|
||||||
|
}
|
||||||
|
|
||||||
|
public function destroy($id)
|
||||||
|
{
|
||||||
|
$tps = LokasiTps::findOrFail($id);
|
||||||
|
|
||||||
|
if ($tps->foto_tps) {
|
||||||
|
Storage::disk('public')->delete($tps->foto_tps);
|
||||||
|
}
|
||||||
|
|
||||||
|
$tps->delete();
|
||||||
|
|
||||||
|
return redirect()->route('tps.index')
|
||||||
|
->with('success', 'Data TPS berhasil dihapus');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -8,11 +8,14 @@ class KategoriTps extends Model
|
||||||
{
|
{
|
||||||
protected $table = 'kategori_tps';
|
protected $table = 'kategori_tps';
|
||||||
|
|
||||||
protected $fillable = ['nama_kategori', 'deskripsi'];
|
protected $fillable = [
|
||||||
|
'nama_kategori',
|
||||||
|
'deskripsi',
|
||||||
|
'foto_kategori'
|
||||||
|
];
|
||||||
|
|
||||||
public function lokasiTps()
|
public function lokasiTps()
|
||||||
{
|
{
|
||||||
return $this->hasMany(LokasiTps::class);
|
return $this->hasMany(LokasiTps::class);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,13 @@
|
||||||
|
|
||||||
namespace App\Models;
|
namespace App\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Factories\HasFactory;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class LokasiTps extends Model
|
class LokasiTps extends Model
|
||||||
{
|
{
|
||||||
|
use HasFactory;
|
||||||
|
|
||||||
protected $table = 'lokasi_tps';
|
protected $table = 'lokasi_tps';
|
||||||
|
|
||||||
protected $fillable = [
|
protected $fillable = [
|
||||||
|
|
@ -16,17 +19,24 @@ class LokasiTps extends Model
|
||||||
'kapasitas_tps',
|
'kapasitas_tps',
|
||||||
'latitude',
|
'latitude',
|
||||||
'longitude',
|
'longitude',
|
||||||
'foto_tps'
|
'foto_tps',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke tabel kategori_tps
|
||||||
|
* One TPS belongs to one kategori
|
||||||
|
*/
|
||||||
public function kategori()
|
public function kategori()
|
||||||
{
|
{
|
||||||
return $this->belongsTo(KategoriTps::class, 'kategori_tps_id');
|
return $this->belongsTo(KategoriTps::class, 'kategori_tps_id');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relasi ke tabel aduan_tps
|
||||||
|
* One TPS has many aduan
|
||||||
|
*/
|
||||||
public function aduan()
|
public function aduan()
|
||||||
{
|
{
|
||||||
return $this->hasMany(AduanTps::class);
|
return $this->hasMany(AduanTps::class, 'lokasi_tps_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('kategori_tps', function (Blueprint $table) {
|
||||||
|
$table->string('foto_kategori')->nullable()->after('deskripsi');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down(): void
|
||||||
|
{
|
||||||
|
Schema::table('kategori_tps', function (Blueprint $table) {
|
||||||
|
$table->dropColumn('foto_kategori');
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
@ -6,54 +6,43 @@
|
||||||
<div class="col-12 grid-margin stretch-card">
|
<div class="col-12 grid-margin stretch-card">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title">Basic form elements</h4>
|
<h4 class="card-title">Tambah Kategori TPS</h4>
|
||||||
<p class="card-description">
|
<p class="card-description">Form tambah data kategori TPS</p>
|
||||||
Basic form elements
|
|
||||||
</p>
|
<form action="{{ route('admin.kategori.store') }}" method="POST" enctype="multipart/form-data">
|
||||||
<form class="forms-sample">
|
@csrf
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exampleInputName1">Name</label>
|
<label>Nama Kategori</label>
|
||||||
<input type="text" class="form-control" id="exampleInputName1" placeholder="Name">
|
<input type="text" name="nama_kategori" class="form-control" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exampleInputEmail3">Email address</label>
|
<label for="exampleTextarea1">Deskripsi</label>
|
||||||
<input type="email" class="form-control" id="exampleInputEmail3" placeholder="Email">
|
<textarea name="deskripsi" class="form-control" id="exampleTextarea1" rows="4"></textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exampleInputPassword4">Password</label>
|
<label>Foto Kategori</label>
|
||||||
<input type="password" class="form-control" id="exampleInputPassword4"
|
|
||||||
placeholder="Password">
|
<input type="file" name="foto_kategori" id="foto_kategori" class="file-upload-default">
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="exampleSelectGender">Gender</label>
|
|
||||||
<select class="form-control" id="exampleSelectGender">
|
|
||||||
<option>Male</option>
|
|
||||||
<option>Female</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>File upload</label>
|
|
||||||
<input type="file" name="img[]" class="file-upload-default">
|
|
||||||
<div class="input-group col-xs-12">
|
<div class="input-group col-xs-12">
|
||||||
<input type="text" class="form-control file-upload-info" disabled
|
<input type="text" class="form-control file-upload-info" disabled
|
||||||
placeholder="Upload Image">
|
placeholder="Upload Foto">
|
||||||
<span class="input-group-append">
|
<span class="input-group-append">
|
||||||
<button class="file-upload-browse btn btn-primary" type="button">Upload</button>
|
<button class="file-upload-browse btn btn-primary" type="button">
|
||||||
|
Upload
|
||||||
|
</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label for="exampleInputCity1">City</label>
|
|
||||||
<input type="text" class="form-control" id="exampleInputCity1"
|
<button class="btn btn-primary">Simpan</button>
|
||||||
placeholder="Location">
|
<a href="{{ route('admin.kategori.index') }}" class="btn btn-light">Batal</a>
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label for="exampleTextarea1">Textarea</label>
|
|
||||||
<textarea class="form-control" id="exampleTextarea1" rows="4"></textarea>
|
|
||||||
</div>
|
|
||||||
<button type="submit" class="btn btn-primary mr-2">Submit</button>
|
|
||||||
<button class="btn btn-light">Cancel</button>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -6,54 +6,59 @@
|
||||||
<div class="col-12 grid-margin stretch-card">
|
<div class="col-12 grid-margin stretch-card">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title">Basic form elements</h4>
|
<h4 class="card-title">Edit Kategori TPS</h4>
|
||||||
<p class="card-description">
|
<p class="card-description">Form edit data kategori TPS</p>
|
||||||
Basic form elements
|
|
||||||
</p>
|
<form action="{{ route('admin.kategori.update', $kategori->id) }}" method="POST"
|
||||||
<form class="forms-sample">
|
enctype="multipart/form-data">
|
||||||
|
@csrf
|
||||||
|
@method('PUT')
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exampleInputName1">Name</label>
|
<label>Nama Kategori</label>
|
||||||
<input type="text" class="form-control" id="exampleInputName1" placeholder="Name">
|
<input type="text" name="nama_kategori" value="{{ $kategori->nama_kategori }}"
|
||||||
|
class="form-control" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exampleInputEmail3">Email address</label>
|
<label>Deskripsi</label>
|
||||||
<input type="email" class="form-control" id="exampleInputEmail3" placeholder="Email">
|
<textarea name="deskripsi" class="form-control">{{ $kategori->deskripsi }}</textarea>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exampleInputPassword4">Password</label>
|
<label>Foto Kategori</label>
|
||||||
<input type="password" class="form-control" id="exampleInputPassword4"
|
|
||||||
placeholder="Password">
|
<!-- INPUT FILE ASLI (HIDDEN - TEMPLATE) -->
|
||||||
</div>
|
<input type="file" name="foto_kategori" id="foto_kategori" class="file-upload-default"
|
||||||
<div class="form-group">
|
accept="image/*">
|
||||||
<label for="exampleSelectGender">Gender</label>
|
|
||||||
<select class="form-control" id="exampleSelectGender">
|
<!-- INPUT DISPLAY -->
|
||||||
<option>Male</option>
|
|
||||||
<option>Female</option>
|
|
||||||
</select>
|
|
||||||
</div>
|
|
||||||
<div class="form-group">
|
|
||||||
<label>File upload</label>
|
|
||||||
<input type="file" name="img[]" class="file-upload-default">
|
|
||||||
<div class="input-group col-xs-12">
|
<div class="input-group col-xs-12">
|
||||||
<input type="text" class="form-control file-upload-info" disabled
|
<input type="text" class="form-control file-upload-info" disabled
|
||||||
placeholder="Upload Image">
|
placeholder="Upload Foto">
|
||||||
|
|
||||||
<span class="input-group-append">
|
<span class="input-group-append">
|
||||||
<button class="file-upload-browse btn btn-primary" type="button">Upload</button>
|
<button class="file-upload-browse btn btn-primary" type="button">
|
||||||
|
Upload
|
||||||
|
</button>
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- PREVIEW FOTO LAMA -->
|
||||||
|
@if (!empty($kategori->foto_kategori))
|
||||||
|
<div class="mt-3">
|
||||||
|
<small class="text-muted">Foto saat ini:</small><br>
|
||||||
|
<img src="{{ asset('storage/' . $kategori->foto_kategori) }}" alt="Foto Kategori"
|
||||||
|
width="120" class="img-thumbnail mt-1">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
@endif
|
||||||
<label for="exampleInputCity1">City</label>
|
|
||||||
<input type="text" class="form-control" id="exampleInputCity1"
|
|
||||||
placeholder="Location">
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
|
||||||
<label for="exampleTextarea1">Textarea</label>
|
|
||||||
<textarea class="form-control" id="exampleTextarea1" rows="4"></textarea>
|
<button class="btn btn-primary">Update</button>
|
||||||
</div>
|
<a href="{{ route('admin.kategori.index') }}" class="btn btn-light">Batal</a>
|
||||||
<button type="submit" class="btn btn-primary mr-2">Submit</button>
|
|
||||||
<button class="btn btn-light">Cancel</button>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -6,84 +6,54 @@
|
||||||
<div class="col-lg-12 grid-margin stretch-card">
|
<div class="col-lg-12 grid-margin stretch-card">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
<div class="d-flex justify-content-between mb-3">
|
||||||
<!-- Header card: Judul kiri, tombol kanan -->
|
<h4 class="card-title">Kategori TPS</h4>
|
||||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
<a href="{{ route('admin.kategori.create') }}" class="btn btn-primary">
|
||||||
<div>
|
+ Tambah
|
||||||
<h4 class="card-title mb-0">Basic Table</h4>
|
|
||||||
<p class="card-description mb-0">
|
|
||||||
Add class <code>.table</code>
|
|
||||||
</p>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<a href="{{ route('admin.tps.create') }}" class="btn btn-primary">
|
|
||||||
<i class="bi bi-plus-lg"></i> Tambah
|
|
||||||
</a>
|
</a>
|
||||||
|
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tabel -->
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Profile</th>
|
<th>Nama Kategori</th>
|
||||||
<th>VatNo.</th>
|
<th>Foto</th>
|
||||||
<th>Created</th>
|
<th>Deskripsi</th>
|
||||||
<th>Status</th>
|
|
||||||
<th>Aksi</th>
|
<th>Aksi</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
@foreach ($kategori as $item)
|
||||||
<tr>
|
<tr>
|
||||||
<td>Jacob</td>
|
<td>{{ $item->nama_kategori }}</td>
|
||||||
<td>53275531</td>
|
<td>
|
||||||
<td>12 May 2017</td>
|
@if ($item->foto_kategori)
|
||||||
<td><label class="badge badge-danger">Pending</label></td>
|
<img src="{{ asset('storage/' . $item->foto_kategori) }}" width="60">
|
||||||
<td class="text-center">
|
@else
|
||||||
<a href="#" class="btn btn-warning btn-sm me-1" title="Edit">
|
-
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
<td>{{ $item->deskripsi ?? '-' }}</td>
|
||||||
|
<td>
|
||||||
|
<a href="{{ route('admin.kategori.edit', $item->id) }}"
|
||||||
|
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>
|
||||||
<a href="#" class="btn btn-danger btn-sm" title="Hapus"
|
<form action="{{ route('admin.kategori.destroy', $item->id) }}"
|
||||||
onclick="return confirm('Yakin ingin menghapus data ini?')">
|
method="POST" style="display:inline-block"
|
||||||
|
onsubmit="return confirm('Yakin ingin menghapus data ini?')">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-danger btn-sm" title="Hapus">
|
||||||
<i class="bi bi-trash"></i>
|
<i class="bi bi-trash"></i>
|
||||||
</a>
|
</button>
|
||||||
|
</form>
|
||||||
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
@endforeach
|
||||||
<td>Messsy</td>
|
|
||||||
<td>53275532</td>
|
|
||||||
<td>15 May 2017</td>
|
|
||||||
<td><label class="badge badge-warning">In progress</label></td>
|
|
||||||
<td class="text-center">
|
|
||||||
<a href="#" class="btn btn-warning btn-sm me-1" title="Edit">
|
|
||||||
<i class="bi bi-pencil-square"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-sm" title="Hapus"
|
|
||||||
onclick="return confirm('Yakin ingin menghapus data ini?')">
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>John</td>
|
|
||||||
<td>53275533</td>
|
|
||||||
<td>14 May 2017</td>
|
|
||||||
<td><label class="badge badge-info">Fixed</label></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Peter</td>
|
|
||||||
<td>53275534</td>
|
|
||||||
<td>16 May 2017</td>
|
|
||||||
<td><label class="badge badge-success">Completed</label></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Dave</td>
|
|
||||||
<td>53275535</td>
|
|
||||||
<td>20 May 2017</td>
|
|
||||||
<td><label class="badge badge-warning">In progress</label></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -61,15 +61,21 @@
|
||||||
<nav class="sidebar sidebar-offcanvas" id="sidebar">
|
<nav class="sidebar sidebar-offcanvas" id="sidebar">
|
||||||
<ul class="nav">
|
<ul class="nav">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="index.html">
|
<a class="nav-link" href="{{ route('admin.dashboard') }}">
|
||||||
<i class="icon-grid menu-icon"></i>
|
<i class="icon-grid menu-icon"></i>
|
||||||
<span class="menu-title">Dashboard</span>
|
<span class="menu-title">Dashboard</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" href="{{ route('admin.tps') }}">
|
<a class="nav-link" href="{{ route('admin.tps.index') }}">
|
||||||
<i class="icon-grid menu-icon"></i>
|
<i class="icon-grid menu-icon"></i>
|
||||||
<span class="menu-title">TPS</span>
|
<span class="menu-title">Kelola TPS</span>
|
||||||
|
</a>
|
||||||
|
</li>
|
||||||
|
<li class="nav-item">
|
||||||
|
<a class="nav-link" href="{{ route('admin.kategori.index') }}">
|
||||||
|
<i class="icon-paper menu-icon"></i>
|
||||||
|
<span class="menu-title">Kategori TPS</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
|
|
@ -231,6 +237,9 @@
|
||||||
<!-- Custom js for this page-->
|
<!-- Custom js for this page-->
|
||||||
<script src="{{ asset('assets/admin/js/dashboard.js') }}"></script>
|
<script src="{{ asset('assets/admin/js/dashboard.js') }}"></script>
|
||||||
<script src="{{ asset('assets/admin/js/Chart.roundedBarCharts.js') }}"></script>
|
<script src="{{ asset('assets/admin/js/Chart.roundedBarCharts.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/admin/vendors/js/vendor.bundle.base.js') }}"></script>
|
||||||
|
<script src="{{ asset('assets/admin/js/file-upload.js') }}"></script>
|
||||||
|
|
||||||
<!-- End custom js for this page-->
|
<!-- End custom js for this page-->
|
||||||
</body>
|
</body>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,62 +1,89 @@
|
||||||
@extends('admin.template')
|
@extends('admin.template')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-12 grid-margin stretch-card">
|
<div class="col-12 grid-margin stretch-card">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h4 class="card-title">Basic form elements</h4>
|
<h4 class="card-title">Tambah TPS</h4>
|
||||||
<p class="card-description">
|
<p class="card-description">Form tambah data TPS</p>
|
||||||
Basic form elements
|
|
||||||
</p>
|
<form action="{{ route('admin.tps.store') }}" method="POST" enctype="multipart/form-data">
|
||||||
<form class="forms-sample">
|
@csrf
|
||||||
|
|
||||||
|
<!-- NAMA TPS -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exampleInputName1">Name</label>
|
<label>Nama TPS</label>
|
||||||
<input type="text" class="form-control" id="exampleInputName1" placeholder="Name">
|
<input type="text" name="nama_tps" class="form-control"
|
||||||
|
placeholder="Nama TPS" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- KATEGORI TPS -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exampleInputEmail3">Email address</label>
|
<label>Kategori TPS</label>
|
||||||
<input type="email" class="form-control" id="exampleInputEmail3" placeholder="Email">
|
<select name="kategori_tps_id" class="form-control" required>
|
||||||
</div>
|
<option value="">Pilih Kategori</option>
|
||||||
<div class="form-group">
|
@foreach ($kategori as $item)
|
||||||
<label for="exampleInputPassword4">Password</label>
|
<option value="{{ $item->id }}">
|
||||||
<input type="password" class="form-control" id="exampleInputPassword4"
|
{{ $item->nama_kategori }}
|
||||||
placeholder="Password">
|
</option>
|
||||||
</div>
|
@endforeach
|
||||||
<div class="form-group">
|
|
||||||
<label for="exampleSelectGender">Gender</label>
|
|
||||||
<select class="form-control" id="exampleSelectGender">
|
|
||||||
<option>Male</option>
|
|
||||||
<option>Female</option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- TAHUN -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label>File upload</label>
|
<label>Tahun Pembuatan</label>
|
||||||
<input type="file" name="img[]" class="file-upload-default">
|
<input type="number" name="tahun_pembuatan" class="form-control"
|
||||||
<div class="input-group col-xs-12">
|
placeholder="Tahun Pembuatan" required>
|
||||||
<input type="text" class="form-control file-upload-info" disabled
|
|
||||||
placeholder="Upload Image">
|
|
||||||
<span class="input-group-append">
|
|
||||||
<button class="file-upload-browse btn btn-primary" type="button">Upload</button>
|
|
||||||
</span>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- KAPASITAS -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exampleInputCity1">City</label>
|
<label>Kapasitas</label>
|
||||||
<input type="text" class="form-control" id="exampleInputCity1"
|
<input type="text" name="kapasitas_tps" class="form-control"
|
||||||
placeholder="Location">
|
placeholder="Kapasitas TPS" required>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<!-- STATUS -->
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="exampleTextarea1">Textarea</label>
|
<label>Status</label>
|
||||||
<textarea class="form-control" id="exampleTextarea1" rows="4"></textarea>
|
<select name="status_tps" class="form-control" required>
|
||||||
|
<option value="Aktif">Aktif</option>
|
||||||
|
<option value="Non-Aktif">Non-Aktif</option>
|
||||||
|
<option value="Pembangunan">Pembangunan</option>
|
||||||
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-primary mr-2">Submit</button>
|
|
||||||
<button class="btn btn-light">Cancel</button>
|
<!-- LATITUDE -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Latitude</label>
|
||||||
|
<input type="text" name="latitude" class="form-control"
|
||||||
|
placeholder="Latitude" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- LONGITUDE -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Longitude</label>
|
||||||
|
<input type="text" name="longitude" class="form-control"
|
||||||
|
placeholder="Longitude" required>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- FOTO -->
|
||||||
|
<div class="form-group">
|
||||||
|
<label>Foto TPS</label>
|
||||||
|
<input type="file" name="foto_tps"
|
||||||
|
class="form-control" accept="image/*">
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="submit" class="btn btn-primary mr-2">Simpan</button>
|
||||||
|
<a href="{{ route('admin.tps.index') }}" class="btn btn-light">Batal</a>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,17 @@
|
||||||
@extends('admin.template')
|
@extends('admin.template')
|
||||||
|
|
||||||
@section('content')
|
@section('content')
|
||||||
<div class="content-wrapper">
|
<div class="content-wrapper">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-lg-12 grid-margin stretch-card">
|
<div class="col-lg-12 grid-margin stretch-card">
|
||||||
<div class="card">
|
<div class="card">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
|
|
||||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||||
<div>
|
<div>
|
||||||
<h4 class="card-title mb-0">Tambah TPS</h4>
|
<h4 class="card-title mb-0">Data TPS</h4>
|
||||||
<p class="card-description mb-0">
|
<p class="card-description mb-0">
|
||||||
Form tambah data Tempat Pengelolaan Sampah (TPS)
|
Daftar Tempat Pengelolaan Sampah (TPS)
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<a href="{{ route('admin.tps.create') }}" class="btn btn-primary">
|
<a href="{{ route('admin.tps.create') }}" class="btn btn-primary">
|
||||||
|
|
@ -18,67 +19,79 @@
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<!-- Tabel -->
|
|
||||||
<div class="table-responsive">
|
<div class="table-responsive">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
<thead>
|
<thead>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Nama</th>
|
<th>Nama TPS</th>
|
||||||
<th>VatNo.</th>
|
<th>Kategori</th>
|
||||||
<th>Created</th>
|
<th>Foto</th>
|
||||||
<th>Status</th>
|
<th>Status</th>
|
||||||
<th>Aksi</th>
|
<th>Aksi</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
|
|
||||||
|
@forelse ($tps as $item)
|
||||||
<tr>
|
<tr>
|
||||||
<td>Jacob</td>
|
<!-- NAMA -->
|
||||||
<td>53275531</td>
|
<td>{{ $item->nama_tps }}</td>
|
||||||
<td>12 May 2017</td>
|
|
||||||
<td><label class="badge badge-danger">Pending</label></td>
|
<!-- KATEGORI -->
|
||||||
|
<td>
|
||||||
|
{{ $item->kategori->nama_kategori ?? '-' }}
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- FOTO -->
|
||||||
|
<td>
|
||||||
|
@if ($item->foto_tps)
|
||||||
|
<img src="{{ asset('storage/' . $item->foto_tps) }}"
|
||||||
|
alt="Foto TPS"
|
||||||
|
height="60"
|
||||||
|
style="border-radius:6px">
|
||||||
|
@else
|
||||||
|
<span class="text-muted">-</span>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- STATUS -->
|
||||||
|
<td>
|
||||||
|
@if ($item->status_tps == 'Aktif')
|
||||||
|
<label class="badge badge-success">Aktif</label>
|
||||||
|
@elseif ($item->status_tps == 'Non-Aktif')
|
||||||
|
<label class="badge badge-secondary">Non-Aktif</label>
|
||||||
|
@else
|
||||||
|
<label class="badge badge-warning">Pembangunan</label>
|
||||||
|
@endif
|
||||||
|
</td>
|
||||||
|
|
||||||
|
<!-- AKSI -->
|
||||||
<td class="text-center">
|
<td class="text-center">
|
||||||
<a href="{{ route('admin.tps.edit') }}" class="btn btn-warning btn-sm me-1" title="Edit">
|
<a href="{{ route('admin.tps.edit', $item->id) }}"
|
||||||
|
class="btn btn-warning btn-sm me-1">
|
||||||
<i class="bi bi-pencil-square"></i>
|
<i class="bi bi-pencil-square"></i>
|
||||||
</a>
|
</a>
|
||||||
<a href="#" class="btn btn-danger btn-sm" title="Hapus"
|
|
||||||
|
<form action="{{ route('admin.tps.destroy', $item->id) }}"
|
||||||
|
method="POST"
|
||||||
|
style="display:inline;">
|
||||||
|
@csrf
|
||||||
|
@method('DELETE')
|
||||||
|
<button class="btn btn-danger btn-sm"
|
||||||
onclick="return confirm('Yakin ingin menghapus data ini?')">
|
onclick="return confirm('Yakin ingin menghapus data ini?')">
|
||||||
<i class="bi bi-trash"></i>
|
<i class="bi bi-trash"></i>
|
||||||
</a>
|
</button>
|
||||||
|
</form>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
@empty
|
||||||
<tr>
|
<tr>
|
||||||
<td>Messsy</td>
|
<td colspan="5" class="text-center">
|
||||||
<td>53275532</td>
|
Data TPS belum tersedia
|
||||||
<td>15 May 2017</td>
|
|
||||||
<td><label class="badge badge-warning">In progress</label></td>
|
|
||||||
<td class="text-center">
|
|
||||||
<a href="#" class="btn btn-warning btn-sm me-1" title="Edit">
|
|
||||||
<i class="bi bi-pencil-square"></i>
|
|
||||||
</a>
|
|
||||||
<a href="#" class="btn btn-danger btn-sm" title="Hapus"
|
|
||||||
onclick="return confirm('Yakin ingin menghapus data ini?')">
|
|
||||||
<i class="bi bi-trash"></i>
|
|
||||||
</a>
|
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
@endforelse
|
||||||
<td>John</td>
|
|
||||||
<td>53275533</td>
|
|
||||||
<td>14 May 2017</td>
|
|
||||||
<td><label class="badge badge-info">Fixed</label></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Peter</td>
|
|
||||||
<td>53275534</td>
|
|
||||||
<td>16 May 2017</td>
|
|
||||||
<td><label class="badge badge-success">Completed</label></td>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
|
||||||
<td>Dave</td>
|
|
||||||
<td>53275535</td>
|
|
||||||
<td>20 May 2017</td>
|
|
||||||
<td><label class="badge badge-warning">In progress</label></td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -87,5 +100,5 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@endsection
|
@endsection
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
use App\Http\Controllers\SigController;
|
use App\Http\Controllers\SigController;
|
||||||
use App\Http\Controllers\AboutController;
|
use App\Http\Controllers\AboutController;
|
||||||
use App\Http\Controllers\Admin\DashboardController;
|
use App\Http\Controllers\Admin\DashboardController;
|
||||||
|
use App\Http\Controllers\Admin\KategoriTpsController;
|
||||||
use App\Http\Controllers\Admin\LoginController;
|
use App\Http\Controllers\Admin\LoginController;
|
||||||
use App\Http\Controllers\Admin\TpsController;
|
use App\Http\Controllers\Admin\TpsController;
|
||||||
use App\Http\Controllers\IndexController;
|
use App\Http\Controllers\IndexController;
|
||||||
|
|
@ -10,39 +11,59 @@
|
||||||
use App\Http\Controllers\KontakController;
|
use App\Http\Controllers\KontakController;
|
||||||
use Illuminate\Support\Facades\Route;
|
use Illuminate\Support\Facades\Route;
|
||||||
|
|
||||||
Route::get('/index', [IndexController::class, 'index'])->name('user.index');
|
/*
|
||||||
Route::get('/about', [AboutController::class, 'index'])->name('user.about');
|
|--------------------------------------------------------------------------
|
||||||
Route::get('/about-tps', [AboutController::class, 'tps'])->name('user.about-tps');
|
| ROUTE USER / PUBLIK
|
||||||
Route::get('/sig-tps', [SigController::class, 'index'])
|
|--------------------------------------------------------------------------
|
||||||
->name('user.sig-tps');
|
*/
|
||||||
Route::get('/tps/{id}', [SigController::class, 'show'])
|
|
||||||
->name('user.detail-tps');
|
|
||||||
Route::get('/aduan-tps', [AduanController::class, 'index'])->name('user.aduan-tps');
|
|
||||||
Route::get('/kontak', [KontakController::class, 'index'])->name('user.kontak');
|
|
||||||
|
|
||||||
// Route::get('/dashboard', [DashboardController::class, 'index'])->name('admin.dashboard');
|
|
||||||
Route::get('/tps-admin', [TpsController::class, 'index'])->name('admin.tps');
|
|
||||||
Route::get('/tps-admin/create', [TpsController::class, 'create'])->name('admin.tps.create');
|
|
||||||
Route::get('/tps-admin/edit', [TpsController::class, 'edit'])->name('admin.tps.edit');
|
|
||||||
Route::get('/login', [LoginController::class, 'index'])->name('admin.login');
|
|
||||||
Route::post('/login', [LoginController::class, 'authenticate'])->name('admin.authenticate');
|
|
||||||
Route::post('/logout', [LoginController::class, 'logout'])->name('admin.logout');
|
|
||||||
|
|
||||||
Route::get('/admin/login', [LoginController::class, 'index'])
|
|
||||||
->name('admin.login');
|
|
||||||
|
|
||||||
Route::post('/admin/login', [LoginController::class, 'process'])
|
|
||||||
->name('admin.login.process');
|
|
||||||
|
|
||||||
Route::post('/admin/logout', [LoginController::class, 'logout'])
|
|
||||||
->name('admin.logout');
|
|
||||||
|
|
||||||
Route::middleware(['auth'])->group(function () {
|
|
||||||
Route::get('/admin/dashboard', [DashboardController::class, 'index'])
|
|
||||||
->name('admin.dashboard');
|
|
||||||
});
|
|
||||||
|
|
||||||
|
|
||||||
Route::get('/', function () {
|
Route::get('/', function () {
|
||||||
return view('welcome');
|
return view('welcome');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Route::get('/index', [IndexController::class, 'index'])->name('user.index');
|
||||||
|
Route::get('/about', [AboutController::class, 'index'])->name('user.about');
|
||||||
|
Route::get('/about-tps', [AboutController::class, 'tps'])->name('user.about-tps');
|
||||||
|
|
||||||
|
Route::get('/sig-tps', [SigController::class, 'index'])->name('user.sig-tps');
|
||||||
|
Route::get('/tps/{id}', [SigController::class, 'show'])->name('user.detail-tps');
|
||||||
|
|
||||||
|
Route::get('/aduan-tps', [AduanController::class, 'index'])->name('user.aduan-tps');
|
||||||
|
Route::get('/kontak', [KontakController::class, 'index'])->name('user.kontak');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| ROUTE AUTH ADMIN
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
Route::get('/admin/login', [LoginController::class, 'index'])->name('admin.login');
|
||||||
|
Route::post('/admin/login', [LoginController::class, 'process'])->name('admin.login.process');
|
||||||
|
Route::post('/admin/logout', [LoginController::class, 'logout'])->name('admin.logout');
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| ROUTE ADMIN (PROTECTED)
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
Route::middleware(['auth'])->prefix('admin')->name('admin.')->group(function () {
|
||||||
|
|
||||||
|
Route::get('/dashboard', [DashboardController::class, 'index'])->name('dashboard');
|
||||||
|
|
||||||
|
// TPS ADMIN
|
||||||
|
Route::get('/tps', [TpsController::class, 'index'])->name('tps.index');
|
||||||
|
Route::get('/tps/create', [TpsController::class, 'create'])->name('tps.create');
|
||||||
|
Route::post('/tps', [TpsController::class, 'store'])->name('tps.store');
|
||||||
|
Route::get('/tps/{id}/edit', [TpsController::class, 'edit'])->name('tps.edit');
|
||||||
|
Route::put('/tps/{id}', [TpsController::class, 'update'])->name('tps.update');
|
||||||
|
Route::delete('/tps/{id}', [TpsController::class, 'destroy'])->name('tps.destroy');
|
||||||
|
|
||||||
|
// KATEGORI TPS ADMIN
|
||||||
|
Route::get('/kategori-tps', [KategoriTpsController::class, 'index'])->name('kategori.index');
|
||||||
|
Route::get('/kategori-tps/create', [KategoriTpsController::class, 'create'])->name('kategori.create');
|
||||||
|
Route::post('/kategori-tps', [KategoriTpsController::class, 'store'])->name('kategori.store');
|
||||||
|
Route::get('/kategori-tps/{id}/edit', [KategoriTpsController::class, 'edit'])->name('kategori.edit');
|
||||||
|
Route::put('/kategori-tps/{id}', [KategoriTpsController::class, 'update'])->name('kategori.update');
|
||||||
|
Route::delete('/kategori-tps/{id}', [KategoriTpsController::class, 'destroy'])->name('kategori.destroy');
|
||||||
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue