tanaman validate

This commit is contained in:
2026-06-18 13:33:37 +07:00
parent 8ead70787c
commit f8304f8f84
@@ -108,13 +108,14 @@ class TanamanController extends Controller
$validated = $request->validate([
'nama' => ['required', 'string', 'max:255'],
'komoditas_id' => ['required', 'exists:master_komoditas,id'],
'lahan_id' => [
'required',
Rule::exists('map_lahan', 'id')->where(function ($query) use ($profileId) {
$query->where('profile_id', $profileId)
->whereNull('deleted_at');
}),
],
'lahan_id' => ['required', 'exists:map_lahan'],
// [
// 'required',
// Rule::exists('map_lahan', 'id')->where(function ($query) use ($profileId) {
// $query->where('profile_id', $profileId)
// ->whereNull('deleted_at');
// }),
// ],
'latitude' => ['nullable', 'numeric', 'between:-90,90', 'required_with:longitude'],
'longitude' => ['nullable ', 'numeric', 'between:-180,180', 'required_with:latitude'],
'kondisi_tanaman' => ['nullable', 'string', new Enum(KondisiTanaman::class)],