src/Schema.php
public function createTable($table, callable $callback = null)
    {
        if ($this->hasTable($table)) {
            throw new Exception("Table $table exist.");
        }

        $schema           = $this->getSchema();
        $schema[ $table ] = [
            'table'      => $table,
            'fields'     => null,
            'increments' => null
        ];

        if (!\is_null($callback)) {
            $builder                          = new TableBuilder();
            call_user_func_array($callback, [ &$builder ]);
            $schema[ $table ][ 'fields' ]     = $builder->build();
            $schema[ $table ][ 'increments' ] = $builder->getIncrement();
        }

        $this->save($this->path, $this->name, $schema);
        $this->create($this->path, $table);
        $this->reloadSchema();

        return $this;
    }
public function createTable($table, callable $callback = null)
    {
        if ($this->hasTable($table)) {
            throw new Exception("Table $table exist.");
        }

        $schema           = $this->getSchema();
        $schema[ $table ] = [
            'table'      => $table,
            'fields'     => null,
            'increments' => null
        ];

        if (!\is_null($callback)) {
            $builder                          = new TableBuilder();
            call_user_func_array($callback, [ &$builder ]);
            $schema[ $table ][ 'fields' ]     = $builder->build();
            $schema[ $table ][ 'increments' ] = $builder->getIncrement();
        }

        $this->save($this->path, $this->name, $schema);
        $this->create($this->path, $table);
        $this->reloadSchema();

        return $this;
    }
public function createTable ( $ table , callable $ callback = null ) { if ( $ this -> hasTable ( $ table ) ) { throw new Exception ( "Table $table exist." ) ; } $ schema = $ this -> getSchema ( ) ; $ schema [ $ table ] = [ 'table' => $ table , 'fields' => null , 'increments' => null ] ; if ( ! \ is_null ( $ callback ) ) { $ builder = new TableBuilder ( ) ; call_user_func_array ( $ callback , [ & $ builder ] ) ; $ schema [ $ table ] [ 'fields' ] = $ builder -> build ( ) ; $ schema [ $ table ] [ 'increments' ] = $ builder -> getIncrement ( ) ; } $ this -> save ( $ this -> path , $ this -> name , $ schema ) ; $ this -> create ( $ this -> path , $ table ) ; $ this -> reloadSchema ( ) ; return $ this ; }
Créer une référence dans le schéma et le fichier de la table.

@param string        $table    Nom de la table.
@param callable|null $callback fonction(TableBuilder $table) pour créer les champs.

@throws Exception
@return $this
Créer une référence dans le schéma et le fichier de la table .