<?php
defined('BASEPATH') or exit('No direct script access allowed');

class DepartmentSeeder extends BaseSeeder
{
    public function run()
    {
        $depts = ['Support', 'Sales', 'Billing', 'Technical'];
        foreach ($depts as $name) {
            if ($this->exists('departments', ['name' => $name])) {
                $this->log("· Exists: $name");
                continue;
            }
            $this->db->insert(db_prefix() . 'departments', [
                'name'  => $name,
                'email' => strtolower($name) . '@example.com',
            ]);
            $this->log("+ Department: $name");
        }
    }
}
