hedronium\Jables\Destroyer::destroyUserTables PHP Method

destroyUserTables() public method

public destroyUserTables ( )
    public function destroyUserTables()
    {
        $builder = $this->db->getSchemaBuilder();
        if (!$builder->hasTable($this->app['config']['jables.table'])) {
            return false;
        }
        $this->buildLists();
        foreach ($this->foreigns as $table_name => $foreigns) {
            if (count($foreigns) === 0) {
                continue;
            }
            $builder->table($table_name, function (Blueprint $table) use($table_name, $foreigns) {
                foreach ($foreigns as $foreign) {
                    $table->dropForeign($foreign);
                }
            });
        }
        foreach ($this->tables as $table) {
            $builder->dropIfExists($table);
        }
        return true;
    }