MIF_E31222541/database/seeders/CriteriaDataSeeder.php

71 lines
1.8 KiB
PHP

<?php
namespace Database\Seeders;
use App\Models\CriteriaData;
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;
class CriteriaDataSeeder extends Seeder
{
/**
* Run the database seeds.
*/
public function run(): void
{
$data = [
[
'id' => '1',
'criteria' => 'ketinggian tempat',
'bobot' => '3',
'status' => 'cost'
],
[
'id' => '2',
'criteria' => 'radiasi matahari',
'bobot' => '3',
'status' => 'benefit'
],
[
'id' => '3',
'criteria' => 'curah hujan',
'bobot' => '5',
'status' => 'benefit'
],
[
'id' => '4',
'criteria' => 'kelembaban udara',
'bobot' => '3',
'status' => 'benefit'
],
[
'id' => '5',
'criteria' => 'temperatur',
'bobot' => '4',
'status' => 'cost'
],
[
'id' => '6',
'criteria' => 'kecepatan angin',
'bobot' => '2',
'status' => 'cost'
],
[
'id' => '7',
'criteria' => 'ph tanah',
'bobot' => '4',
'status' => 'benefit'
]
];
foreach ($data as $key => $value) {
CriteriaData::create([
'id' => $value['id'],
'criteria' => $value['criteria'],
'bobot' => $value['bobot'],
'status' => $value['status']
]);
}
}
}