本文整理匯總了PHP中Illuminate\Database\Schema\Builder::create方法的典型用法代碼示例。如果您正苦於以下問題:PHP Builder::create方法的具體用法?PHP Builder::create怎麽用?PHP Builder::create使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Schema\Builder
的用法示例。
在下文中一共展示了Builder::create方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('roles', function (Blueprint $table) {
$table->increments('id');
$table->string('name')->unique();
});
}
示例2: up
/**
* Run the migrations.
*/
public function up()
{
$this->schema->create('password_resets', function (Blueprint $table) {
$table->string('email')->index();
$table->string('token')->index();
$table->timestamp('created_at');
});
}
示例3: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('ages', function (Blueprint $table) {
$table->increments('id');
$table->string('from');
$table->string('to');
});
}
示例4: up
/**
* Do the migration
*/
public function up()
{
//Create
$this->schema->create('account_status', function ($table) {
$table->increments('id');
$table->string('value', 200);
$table->dateTime('created_at')->default(DB::raw('CURRENT_TIMESTAMP'));
});
}
示例5: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('notifications', function (Blueprint $table) {
$table->increments('id');
$table->string('title');
$table->string('body');
$table->dateTime('release_date');
$table->timestamps();
});
}
示例6: handle
/**
* Install the extensions table.
*/
public function handle()
{
$this->schema->dropIfExists('addons_extensions');
$this->schema->create('addons_extensions', function (Blueprint $table) {
$table->increments('id');
$table->string('slug');
$table->boolean('installed')->default(0);
$table->boolean('enabled')->default(0);
});
}
示例7: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('user_roles', function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->index();
$table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
$table->integer('role_id')->unsigned()->index();
$table->foreign('role_id')->references('id')->on('roles')->onDelete('cascade');
});
}
示例8: up
/**
* Do the migration
*/
public function up()
{
$this->schema->create('posts', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->text('content');
$table->timestamps();
$table->softDeletes();
$table->foreign('user_id')->references('id')->on('users');
});
}
示例9: up
/**
* Do the migration
*/
public function up()
{
//Create table
$this->schema->create('ci_sessions', function ($table) {
$table->string('session_id', 40);
$table->string('ip_address', 45);
$table->string('user_agent', 120);
$table->integer('last_activity')->unsigned();
$table->text('user_data');
});
}
示例10: up
/**
* Run the migrations.
*/
public function up()
{
$this->schema->create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password');
$table->rememberToken();
$table->timestamps();
});
}
示例11: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('products', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('code')->unique();
$table->string('image');
$table->string('poster');
$table->timestamps();
});
}
示例12: up
/**
* Do the migration
*/
public function up()
{
//Creates contents table
$this->schema->create('contents', function ($table) {
$table->increments('id');
$table->string('title');
$table->text('text');
$table->timestamps();
$table->softDeletes();
});
}
示例13: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$this->schema->create('profiles', function (Blueprint $table) {
$table->increments('id');
$table->string('image');
$table->longText('description');
$table->integer('product_id')->unsigned()->index();
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
$table->timestamps();
});
}
示例14: up
/**
* Do the migration
*/
public function up()
{
$this->schema->create('likes', function ($table) {
$table->increments('id');
$table->integer('user_id')->unsigned();
$table->string('resourceable_type');
$table->string('resourceable_id');
$table->timestamps();
$table->softDeletes();
$table->foreign('user_id')->references('id')->on('users');
});
}
示例15: runTestMigrations
/**
* Run migrations for tables only used for testing purposes.
*
* @return void
*/
protected function runTestMigrations()
{
include_once __DIR__ . '/../resources/migrations/create_adjustments_table.php.stub';
(new \CreateAdjustmentsTable())->up();
if (!$this->schema->hasTable('fruits')) {
$this->schema->create('fruits', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->integer('price');
});
}
}