<?php

namespace Database\Seeders;

use Illuminate\Support\Facades\DB;
use JeroenZwart\CsvSeeder\CsvSeeder;

class OrderNumberSeeder extends CsvSeeder
{
    public function __construct()
    {
        $reflect = new \ReflectionClass($this);
        $tableName = from_camel_case(str_replace('Seeder', '', $reflect->getShortName())).'s';
        $this->tablename = $tableName;
        $this->delimiter = ';';
        $this->file = base_path().'/database/csv/'.$this->tablename.'.csv';
        $this->truncate = false;
    }

    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        // DB::disableQueryLog();
        \Schema::disableForeignKeyConstraints();
        DB::table($this->tablename)->delete();
        parent::run();
        \Schema::enableForeignKeyConstraints();
    }
}
