Update Stuktur Menu & Controller
This commit is contained in:
@@ -1,134 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Ekosistem;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Penduduk\Keluarga;
|
||||
use App\Models\Wilayah\Provinsi;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class KeluargaController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = Keluarga::with(['desakelurahan', 'adat'])->orderBy('created_at', 'desc');
|
||||
|
||||
if ($request->search) {
|
||||
$query->where('kk', 'like', '%' . $request->search . '%');
|
||||
}
|
||||
|
||||
$keluarga = $query->paginate($request->per_page ?? 10);
|
||||
return view('master.keluarga.index', compact('keluarga'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$provinsi = Provinsi::orderBy('nama', 'asc')->get();
|
||||
return view('master.keluarga.add', compact('provinsi'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'kk' => ['required', 'string', 'min:16', 'max:16'],
|
||||
'desa_kelurahan_id' => ['required'],
|
||||
'adat_id' => ['nullable'],
|
||||
'file_kk' => ['nullable', 'file', 'mimes:jpeg,jpg,png,pdf', 'max:2048'],
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422);
|
||||
}
|
||||
|
||||
$pathKk = null;
|
||||
$fileNameKk = null;
|
||||
|
||||
if ($request->hasFile('file_kk')) {
|
||||
$file = $request->file('file_kk');
|
||||
$fileNameKk = $file->getClientOriginalName();
|
||||
$pathKk = $file->store('uploads/keluarga', 'public');
|
||||
}
|
||||
|
||||
Keluarga::create([
|
||||
'kk' => $request->kk,
|
||||
'desa_kelurahan_id' => $request->desa_kelurahan_id,
|
||||
'adat_id' => $request->adat_id,
|
||||
'path_kk' => $pathKk,
|
||||
'file_kk' => $fileNameKk,
|
||||
'created_by' => auth()->id(),
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json(['status' => 'success', 'message' => 'Data Keluarga berhasil ditambahkan.']);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$keluarga = Keluarga::with(['desakelurahan.kecamatan.kabupatenkota.provinsi', 'adat'])->findOrFail($id);
|
||||
return view('master.keluarga.view', compact('keluarga'));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$keluarga = Keluarga::with(['desakelurahan.kecamatan.kabupatenkota.provinsi', 'adat'])->findOrFail($id);
|
||||
$provinsi = Provinsi::orderBy('nama', 'asc')->get();
|
||||
return view('master.keluarga.edit', compact('keluarga', 'provinsi'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'kk' => ['required', 'string', 'min:16', 'max:16'],
|
||||
'desa_kelurahan_id' => ['required'],
|
||||
'adat_id' => ['nullable'],
|
||||
'file_kk' => ['nullable', 'file', 'mimes:jpeg,jpg,png,pdf', 'max:2048'],
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422);
|
||||
}
|
||||
|
||||
$keluarga = Keluarga::findOrFail($id);
|
||||
|
||||
$pathKk = $keluarga->path_kk;
|
||||
$fileNameKk = $keluarga->file_kk;
|
||||
|
||||
if ($request->hasFile('file_kk')) {
|
||||
|
||||
if ($keluarga->path_kk && Storage::disk('public')->exists($keluarga->path_kk)) {
|
||||
Storage::disk('public')->delete($keluarga->path_kk);
|
||||
}
|
||||
|
||||
$file = $request->file('file_kk');
|
||||
$fileNameKk = $file->getClientOriginalName();
|
||||
$pathKk = $file->store('uploads/keluarga', 'public');
|
||||
}
|
||||
|
||||
$keluarga->update([
|
||||
'kk' => $request->kk,
|
||||
'desa_kelurahan_id' => $request->desa_kelurahan_id,
|
||||
'adat_id' => $request->adat_id,
|
||||
'path_kk' => $pathKk,
|
||||
'file_kk' => $fileNameKk,
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json(['status' => 'success', 'message' => 'Data Keluarga berhasil diupdate.']);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$keluarga = Keluarga::findOrFail($id);
|
||||
|
||||
// if ($keluarga->path_kk && Storage::disk('public')->exists($keluarga->path_kk)) {
|
||||
// Storage::disk('public')->delete($keluarga->path_kk);
|
||||
// }
|
||||
|
||||
$keluarga->update(['deleted_by' => auth()->id()]);
|
||||
$keluarga->delete();
|
||||
|
||||
return response()->json(['status' => 'success', 'message' => 'Data Keluarga berhasil dihapus.']);
|
||||
}
|
||||
}
|
||||
@@ -1,81 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Ekosistem;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Pertanian\Komoditas;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class KomoditasController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = Komoditas::orderBy('created_at', 'desc');
|
||||
|
||||
if ($request->search) {
|
||||
$query->where('nama', 'like', '%' . $request->search . '%');
|
||||
}
|
||||
|
||||
$komoditas = $query->paginate($request->per_page ?? 10);
|
||||
return view('master.komoditas.index', compact('komoditas'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'nama' => ['required', 'string', 'max:255', 'unique:master_komoditas,nama'], // Tambah unique biar nggak ada data kembar
|
||||
], [
|
||||
'nama.unique' => 'Nama komoditas ini sudah ada di database.'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422);
|
||||
}
|
||||
|
||||
Komoditas::create([
|
||||
'nama' => $request->nama,
|
||||
'created_by' => auth()->id(),
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json(['status' => 'success', 'message' => 'Komoditas berhasil ditambahkan.']);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$komoditas = Komoditas::findOrFail($id);
|
||||
return response()->json(['status' => 'success', 'data' => $komoditas]);
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'nama' => ['required', 'string', 'max:255', 'unique:master_komoditas,nama,' . $id],
|
||||
], [
|
||||
'nama.unique' => 'Nama komoditas ini sudah digunakan.'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422);
|
||||
}
|
||||
|
||||
$komoditas = Komoditas::findOrFail($id);
|
||||
$komoditas->update([
|
||||
'nama' => $request->nama,
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json(['status' => 'success', 'message' => 'Komoditas berhasil diupdate.']);
|
||||
}
|
||||
|
||||
public function destroy($id)
|
||||
{
|
||||
$komoditas = Komoditas::findOrFail($id);
|
||||
|
||||
$komoditas->update(['deleted_by' => auth()->id()]);
|
||||
$komoditas->delete();
|
||||
|
||||
return response()->json(['status' => 'success', 'message' => 'Komoditas berhasil dihapus.']);
|
||||
}
|
||||
}
|
||||
@@ -1,82 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Ekosistem;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Pertanian\Lahan;
|
||||
use App\Models\Profile;
|
||||
use App\Models\Wilayah\Provinsi;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class LahanController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = Lahan::with(['profile', 'desakelurahan'])->orderBy('created_at', 'desc');
|
||||
|
||||
if ($request->search) {
|
||||
$query->where('nama', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('profile', function($q) use ($request) {
|
||||
$q->where('nama', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
}
|
||||
|
||||
$lahan = $query->paginate($request->per_page ?? 10);
|
||||
return view('master.lahan.index', compact('lahan'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$provinsi = Provinsi::orderBy('nama', 'asc')->get();
|
||||
$profiles = Profile::orderBy('nama', 'asc')->get();
|
||||
return view('master.lahan.add', compact('provinsi', 'profiles'));
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'nama' => ['required', 'string', 'max:255'],
|
||||
'status_kepemilikan' => ['required', 'string', 'max:255'],
|
||||
'profile_id' => ['required'],
|
||||
'keluarga_pengelola_id' => ['nullable'],
|
||||
'adat_pemilik_id' => ['nullable'],
|
||||
'desa_kelurahan_id' => ['nullable'],
|
||||
'luas_lahan' => ['nullable', 'numeric'],
|
||||
'path' => ['nullable', 'string'],
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422);
|
||||
}
|
||||
|
||||
if ($request->filled('path')) {
|
||||
json_decode($request->path);
|
||||
if (json_last_error() !== JSON_ERROR_NONE) {
|
||||
return response()->json(['status' => 'error', 'message' => 'Format koordinat (path) bukan JSON array yang valid.'], 422);
|
||||
}
|
||||
}
|
||||
|
||||
Lahan::create([
|
||||
'nama' => $request->nama,
|
||||
'status_kepemilikan' => $request->status_kepemilikan,
|
||||
'profile_id' => $request->profile_id,
|
||||
'desa_kelurahan_id' => $request->desa_kelurahan_id,
|
||||
'luas_lahan' => $request->luas_lahan,
|
||||
'path' => $request->path,
|
||||
'created_by' => auth()->id(),
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json(['status' => 'success', 'message' => 'Lahan berhasil ditambahkan.']);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$lahan = Lahan::with(['profile', 'desakelurahan.kecamatan.kabupatenkota.provinsi', 'tanaman.komoditas'])->findOrFail($id);
|
||||
|
||||
return view('master.lahan.view', compact('lahan'));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,209 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Ekosistem;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Wilayah\Provinsi;
|
||||
use App\Models\Profile;
|
||||
use App\Models\User;
|
||||
use Illuminate\Support\Facades\Storage;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class ProfileController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
// Ambil data provinsi untuk kebutuhan dropdown teratas
|
||||
$provinsi = Provinsi::orderBy('nama', 'asc')->get();
|
||||
|
||||
// Query untuk tabel dengan fitur search dan pagination
|
||||
$query = Profile::with('desakelurahan')->orderBy('created_at', 'desc');
|
||||
|
||||
if ($request->search) {
|
||||
$query->where('nama', 'like', '%' . $request->search . '%')
|
||||
->orWhere('email', 'like', '%' . $request->search . '%');
|
||||
}
|
||||
|
||||
$profiles = $query->paginate($request->per_page ?? 10);
|
||||
|
||||
return view('master.profile.index', compact('profiles', 'provinsi'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$provinsi = Provinsi::orderBy('nama', 'asc')->get();
|
||||
return view('master.profile.add', compact('provinsi'));
|
||||
}
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'nama' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'email', 'max:255'],
|
||||
'telepon' => ['required', 'max:13'],
|
||||
'desa_kelurahan_id' => ['required'],
|
||||
'ktp' => ['nullable', 'min:16', 'max:16'],
|
||||
'file_ktp' => ['nullable', 'file', 'mimes:jpeg,jpg,png,pdf', 'max:2048'],
|
||||
'kk' => ['nullable', 'min:16', 'max:16'],
|
||||
'file_kk' => ['nullable', 'file', 'mimes:jpeg,jpg,png,pdf', 'max:2048'],
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'errors' => $validator->errors()
|
||||
], 422);
|
||||
}
|
||||
|
||||
$user = User::where('email', $request->email)->first();
|
||||
|
||||
if (!$user) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'User dengan email tersebut tidak ditemukan'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$userid = $user->id;
|
||||
$userrole = $user->role;
|
||||
|
||||
$pathktp = null;
|
||||
$pathkk = null;
|
||||
|
||||
if ($request->hasFile('file_ktp')) {
|
||||
$pathktp = $request->file('file_ktp')->store('uploads/users/ktp', 'public');
|
||||
}
|
||||
|
||||
if ($request->hasFile('file_kk')) {
|
||||
$pathkk = $request->file('file_kk')->store('uploads/users/kk', 'public');
|
||||
}
|
||||
|
||||
Profile::create([
|
||||
'user_id' => $userid,
|
||||
'role' => $userrole,
|
||||
'nama' => $request->nama,
|
||||
'email' => $request->email,
|
||||
'telepon' => $request->telepon,
|
||||
'alamat' => $request->alamat,
|
||||
'kk' => $request->kk,
|
||||
'ktp' => $request->ktp,
|
||||
'desa_kelurahan_id' => $request->desa_kelurahan_id,
|
||||
'path_kk' => $pathkk,
|
||||
'path_ktp' => $pathktp,
|
||||
'keluarga_id' => $request->keluarga_id,
|
||||
'created_by' => auth()->id(),
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Profile berhasil ditambahkan.'
|
||||
]);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$profile = Profile::with('desakelurahan.kecamatan.kabupatenkota.provinsi')->findOrFail($id);
|
||||
return view('master.profile.view', compact('profile'));
|
||||
}
|
||||
|
||||
public function edit($id)
|
||||
{
|
||||
$profile = Profile::with('desakelurahan.kecamatan.kabupatenkota.provinsi')->findOrFail($id);
|
||||
$provinsi = Provinsi::orderBy('nama', 'asc')->get();
|
||||
return view('master.profile.edit', compact('profile', 'provinsi'));
|
||||
}
|
||||
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'nama' => ['required', 'string', 'max:255'],
|
||||
'email' => ['required', 'email', 'max:255'],
|
||||
'telepon' => ['required', 'max:13'],
|
||||
'desa_kelurahan_id' => ['required'],
|
||||
'ktp' => ['nullable', 'min:16', 'max:16'],
|
||||
'file_ktp' => ['nullable', 'file', 'mimes:jpeg,jpg,png,pdf', 'max:2048'],
|
||||
'kk' => ['nullable', 'min:16', 'max:16'],
|
||||
'file_kk' => ['nullable', 'file', 'mimes:jpeg,jpg,png,pdf', 'max:2048'],
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'errors' => $validator->errors()
|
||||
], 422);
|
||||
}
|
||||
|
||||
$profile = Profile::findOrFail($id);
|
||||
|
||||
$user = User::where('email', $request->email)->first();
|
||||
|
||||
if (!$user) {
|
||||
return response()->json([
|
||||
'status' => 'error',
|
||||
'message' => 'User dengan email tersebut tidak ditemukan'
|
||||
], 404);
|
||||
}
|
||||
|
||||
$pathktp = $profile->path_ktp;
|
||||
$pathkk = $profile->path_kk;
|
||||
|
||||
if ($request->hasFile('file_ktp')) {
|
||||
if ($profile->path_ktp && \Storage::disk('public')->exists($profile->path_ktp)) {
|
||||
\Storage::disk('public')->delete($profile->path_ktp);
|
||||
}
|
||||
$pathktp = $request->file('file_ktp')->store('uploads/users/ktp', 'public');
|
||||
}
|
||||
|
||||
if ($request->hasFile('file_kk')) {
|
||||
if ($profile->path_kk && \Storage::disk('public')->exists($profile->path_kk)) {
|
||||
\Storage::disk('public')->delete($profile->path_kk);
|
||||
}
|
||||
$pathkk = $request->file('file_kk')->store('uploads/users/kk', 'public');
|
||||
}
|
||||
|
||||
$profile->update([
|
||||
'user_id' => $user->id,
|
||||
'role' => $user->role,
|
||||
'nama' => $request->nama,
|
||||
'email' => $request->email,
|
||||
'telepon' => $request->telepon,
|
||||
'alamat' => $request->alamat,
|
||||
'kk' => $request->kk,
|
||||
'ktp' => $request->ktp,
|
||||
'desa_kelurahan_id' => $request->desa_kelurahan_id,
|
||||
'path_kk' => $pathkk,
|
||||
'path_ktp' => $pathktp,
|
||||
'keluarga_id' => $request->keluarga_id, // Pastikan input ini dikirim dari form, kalau tidak hapus saja
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Profile berhasil diupdate.'
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Menghapus data profile (serta file fisiknya)
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$profile = Profile::findOrFail($id);
|
||||
|
||||
// if ($profile->path_ktp && Storage::disk('public')->exists($profile->path_ktp)) {
|
||||
// Storage::disk('public')->delete($profile->path_ktp);
|
||||
// }
|
||||
// if ($profile->path_kk && Storage::disk('public')->exists($profile->path_kk)) {
|
||||
// Storage::disk('public')->delete($profile->path_kk);
|
||||
// }
|
||||
$profile->deleted_by = auth()->user()->id;
|
||||
$profile->save();
|
||||
$profile->delete();
|
||||
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'message' => 'Data dan dokumen berhasil dihapus'
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Http\Controllers\Web\Ekosistem;
|
||||
|
||||
use App\Http\Controllers\Controller;
|
||||
use Illuminate\Http\Request;
|
||||
use App\Models\Pertanian\Tanaman;
|
||||
use App\Models\Pertanian\Komoditas;
|
||||
use App\Models\Pertanian\Lahan;
|
||||
use App\Models\Profile;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
|
||||
class TanamanController extends Controller
|
||||
{
|
||||
public function index(Request $request)
|
||||
{
|
||||
$query = Tanaman::with(['komoditas', 'lahan', 'profile'])->orderBy('created_at', 'desc');
|
||||
|
||||
if ($request->search) {
|
||||
$query->where('nama', 'like', '%' . $request->search . '%')
|
||||
->orWhereHas('lahan', function($q) use ($request) {
|
||||
$q->where('nama', 'like', '%' . $request->search . '%');
|
||||
});
|
||||
}
|
||||
|
||||
$tanaman = $query->paginate($request->per_page ?? 10);
|
||||
return view('master.tanaman.index', compact('tanaman'));
|
||||
}
|
||||
|
||||
public function create()
|
||||
{
|
||||
$komoditas = Komoditas::orderBy('nama', 'asc')->get();
|
||||
$profiles = Profile::orderBy('nama', 'asc')->get();
|
||||
$lahan = Lahan::orderBy('nama', 'asc')->get();
|
||||
|
||||
return view('master.tanaman.add', compact('komoditas', 'profiles', 'lahan'));
|
||||
}
|
||||
|
||||
public function getLahan($id)
|
||||
{
|
||||
$lahan = Lahan::findOrFail($id);
|
||||
return response()->json([
|
||||
'status' => 'success',
|
||||
'path' => $lahan->path
|
||||
]);
|
||||
}
|
||||
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'nama' => ['required', 'string', 'max:255'],
|
||||
'komoditas_id' => ['required'],
|
||||
'profile_id' => ['required'],
|
||||
'lahan_id' => ['required'],
|
||||
'kondisi_tanaman' => ['required', 'in:sehat,sakit,mati'],
|
||||
'latitude' => ['required', 'numeric'],
|
||||
'longitude' => ['required', 'numeric'],
|
||||
], [
|
||||
'latitude.required' => 'Titik koordinat wajib diisi. Silakan klik area pada peta.'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
return response()->json(['status' => 'error', 'errors' => $validator->errors()], 422);
|
||||
}
|
||||
|
||||
Tanaman::create([
|
||||
'nama' => $request->nama,
|
||||
'komoditas_id' => $request->komoditas_id,
|
||||
'profile_id' => $request->profile_id,
|
||||
'lahan_id' => $request->lahan_id,
|
||||
'kondisi_tanaman' => $request->kondisi_tanaman,
|
||||
'latitude' => $request->latitude,
|
||||
'longitude' => $request->longitude,
|
||||
'created_by' => auth()->id(),
|
||||
'updated_by' => auth()->id(),
|
||||
]);
|
||||
|
||||
return response()->json(['status' => 'success', 'message' => 'Data Tanaman berhasil ditambahkan.']);
|
||||
}
|
||||
|
||||
public function show($id)
|
||||
{
|
||||
$tanaman = Tanaman::with(['komoditas', 'lahan', 'profile'])->findOrFail($id);
|
||||
return view('master.tanaman.view', compact('tanaman'));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user