49 lines
2.7 KiB
PHP
49 lines
2.7 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' => "Asam", 'description' => "Tingkat keasaman pH tanah kurang dari 6", 'cf' => -0.6],
|
|
['indicator_id' => 1, 'parameter_type' => "Ideal", 'description' => "Tingkat keasaman pH tanah antara 6.0 - 7.0", 'cf' => 0.8],
|
|
['indicator_id' => 1, 'parameter_type' => "Basa", 'description' => "Tingkat keasaman pH tanah lebih dari 7.0", 'cf' => -0.8],
|
|
|
|
// Ketinggian Tempat
|
|
['indicator_id' => 2, 'parameter_type' => "Rendah", 'description' => "Lahan berada di dataran rendah (<200 mdpl)", 'cf' => -0.6],
|
|
['indicator_id' => 2, 'parameter_type' => "Sedang", 'description' => "Lahan berada di ketinggian sedang (250 - 600 mdpl)", 'cf' => 0.8],
|
|
['indicator_id' => 2, 'parameter_type' => "Tinggi", 'description' => "Lahan berada di dataran tinggi (>600 mdpl)", 'cf' => -0.4],
|
|
|
|
// 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.6],
|
|
['indicator_id' => 3, 'parameter_type' => "Terbatas", 'description' => "Kadang-kadang mengalami kekeringan", 'cf' => -0.6],
|
|
|
|
// 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' => "Telalu Dekat", 'description' => "Jarak antar lahan sangat dekat < 250 meter", 'cf' => -0.8],
|
|
['indicator_id' => 5, 'parameter_type' => "Aman", 'description' => "Jarak antar lahan cukup jauh 250 - 400 meter", 'cf' => 0.8],
|
|
['indicator_id' => 5, 'parameter_type' => "Jauh", 'description' => "Jarak antar lahan jauh > 400 meter", 'cf' => 1.0],
|
|
];
|
|
|
|
foreach ($rules as $rule) {
|
|
Rule::create($rule);
|
|
}
|
|
}
|
|
}
|