53 lines
3.3 KiB
PHP
53 lines
3.3 KiB
PHP
<?php
|
|
|
|
namespace Database\Seeders;
|
|
|
|
use App\Models\Rule;
|
|
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
|
use Illuminate\Database\Seeder;
|
|
|
|
class RuleSeeder extends Seeder
|
|
{
|
|
/**
|
|
* Run the database seeds.
|
|
*/
|
|
public function run(): void
|
|
{
|
|
$rules = [
|
|
// pH Tanah
|
|
['indicator_id' => 1, 'parameter_type' => "Sangat Asam", 'description' => "Tingkat keasaman pH tanah kurang dari 5.5", 'cf' => -0.6],
|
|
['indicator_id' => 1, 'parameter_type' => "Asam", 'description' => "Tingkat keasaman pH tanah antara 5.5 - 6.0", 'cf' => 0.6],
|
|
['indicator_id' => 1, 'parameter_type' => "Netral", 'description' => "Tingkat keasaman pH tanah antara 6.1 - 7.0", 'cf' => 1.0],
|
|
['indicator_id' => 1, 'parameter_type' => "Basa", 'description' => "Tingkat keasaman pH tanah antara 7.1 - 7.5", 'cf' => 0.6],
|
|
['indicator_id' => 1, 'parameter_type' => "Sangat Basa", 'description' => "Tingkat keasaman pH tanah lebih besar dari 7.5", 'cf' => -0.4],
|
|
|
|
// Ketinggian Tempat
|
|
['indicator_id' => 2, 'parameter_type' => "Rendah", 'description' => "Lahan berada di dataran rendah (<300 mdpl)", 'cf' => 1.0],
|
|
['indicator_id' => 2, 'parameter_type' => "Sedang", 'description' => "Lahan berada di ketinggian sedang (300 - 700 mdpl)", 'cf' => 0.7],
|
|
['indicator_id' => 2, 'parameter_type' => "Tinggi", 'description' => "Lahan berada di dataran tinggi (>700 mdpl)", 'cf' => -0.5],
|
|
|
|
// Ketersediaan Air
|
|
['indicator_id' => 3, 'parameter_type' => "Berlimpah", 'description' => "Irigasi teknis, air selalu tersedia sepanjang tahun", 'cf' => 1.0],
|
|
['indicator_id' => 3, 'parameter_type' => "Cukup", 'description' => "Sumber air stabil, tetapi tidak selalu tersedia", 'cf' => 0.8],
|
|
['indicator_id' => 3, 'parameter_type' => "Terbatas", 'description' => "Kadang-kadang mengalami kekeringan", 'cf' => -0.5],
|
|
['indicator_id' => 3, 'parameter_type' => "Sangat Terbatas", 'description' => "Sering mengalami kekeringan", 'cf' => -0.8],
|
|
|
|
// Curah Hujan
|
|
['indicator_id' => 4, 'parameter_type' => "Rendah", 'description' => "Curah hujan kurang dari 1000 mm/tahun", 'cf' => -0.6],
|
|
['indicator_id' => 4, 'parameter_type' => "Sedang", 'description' => "Curah hujan antara 1000 - 1500 mm/tahun", 'cf' => 0.6],
|
|
['indicator_id' => 4, 'parameter_type' => "Tinggi", 'description' => "Curah hujan antara 1500 - 2000 mm/tahun", 'cf' => 0.8],
|
|
['indicator_id' => 4, 'parameter_type' => "Sangat Tinggi", 'description' => "Curah hujan lebih dari 2000 mm/tahun", 'cf' => -0.4],
|
|
|
|
// Isolasi (Jarak Antar Lahan)
|
|
['indicator_id' => 5, 'parameter_type' => "Sangat Baik", 'description' => "Jarak antar lahan sangat dekat (0 - 50 meter)", 'cf' => 1.0],
|
|
['indicator_id' => 5, 'parameter_type' => "Baik", 'description' => "Jarak antar lahan cukup dekat (50 - 200 meter)", 'cf' => 0.8],
|
|
['indicator_id' => 5, 'parameter_type' => "Sedang", 'description' => "Jarak antar lahan cukup jauh (200 - 500 meter)", 'cf' => -0.4],
|
|
['indicator_id' => 5, 'parameter_type' => "Buruk", 'description' => "Lahan sangat terisolasi (>500 meter)", 'cf' => -0.7],
|
|
];
|
|
|
|
foreach ($rules as $rule) {
|
|
Rule::create($rule);
|
|
}
|
|
}
|
|
}
|