<?php
namespace Database\Seeders;

use Illuminate\Database\Seeder;
use App\Models\Config;

class ConfigSeeder extends Seeder
{
  /**
  * Run the database seeds.
  *
  * @return void
  */
  public function run()
  {
    foreach(Config::getConfig() as $key => $group){
      $order = 1;
      foreach($group as $key2 => $c){
        $config = Config::find($c['key']);
        if($config == null){
          $config = new Config;
          $config->fill($c);
          $config->order = $order;
          $config->group = $key;
          $config->save();
        }
        $order++;
      }
    }
  }
}
