<?php

use Illuminate\Database\Seeder;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        $this->call(CreateAdminSeeder::class);
        $this->call(SettingsSeeder::class);
    }
}

class CreateAdminSeeder extends Seeder {
    public function run() {
        $data = [
            [
                'name' => 'admin',
                'password' => md5('admin'),
                'level' => 20,
                'server' => 1,
                'lastserver' => 1,
                'lastip' => '::1',
            ],
        ];
        DB::table('users')->delete();
        DB::table('users')->truncate();
        DB::table('users')->insert($data);
    }
}

class SettingsSeeder extends Seeder {
    public function run() {
        $data = [
            [
                'slug' => 'copyright',
                'value' => null,
            ],
        ];
        DB::table('settings')->delete();
        DB::table('settings')->truncate();
        DB::table('settings')->insert($data);
    }
}
