Flarum\Database\Migration::createTable PHP Method

createTable() public static method

Create a table.
public static createTable ( $name, callable $definition )
$definition callable
    public static function createTable($name, callable $definition)
    {
        return ['up' => function (Builder $schema) use($name, $definition) {
            $schema->create($name, $definition);
        }, 'down' => function (Builder $schema) use($name) {
            $schema->drop($name);
        }];
    }

Usage Example

<?php

/*
 * This file is part of Flarum.
 *
 * (c) Toby Zerner <*****@*****.**>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */
use Flarum\Database\Migration;
use Illuminate\Database\Schema\Blueprint;
return Migration::createTable('discussions_tags', function (Blueprint $table) {
    $table->integer('discussion_id')->unsigned();
    $table->integer('tag_id')->unsigned();
    $table->primary(['discussion_id', 'tag_id']);
});
All Usage Examples Of Flarum\Database\Migration::createTable