本文整理汇总了PHP中Schema::hasColumns方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::hasColumns方法的具体用法?PHP Schema::hasColumns怎么用?PHP Schema::hasColumns使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Schema
的用法示例。
在下文中一共展示了Schema::hasColumns方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
if (Schema::hasTable('hlogeon_scms_types')) {
if (Schema::hasColumns('hlogeon_scms_types', ['list_layout_id', 'enable_own_sidebar'])) {
Schema::table('hlogeon_scms_types', function (Blueprint $table) {
$table->dropColumn('list_layout_id');
$table->dropColumn('type_layout_id');
$table->dropColumn('enable_own_sidebar');
$table->string('type_layout');
});
}
}
}
示例2: up
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
if (!Schema::hasTable('users')) {
Schema::create('users', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('email')->unique();
$table->string('password', 60);
$table->rememberToken();
// Two-Factor Authentication Columns...
$table->string('phone_country_code')->nullable();
$table->string('phone_number')->nullable();
$table->text('two_factor_options')->nullable();
// Team Columns...
$table->integer('current_team_id')->nullable();
// Cashier Columns...
$table->tinyInteger('stripe_active')->default(0);
$table->string('stripe_id')->nullable();
$table->string('stripe_subscription')->nullable();
$table->string('stripe_plan', 100)->nullable();
$table->string('last_four', 4)->nullable();
$table->text('extra_billing_info')->nullable();
$table->timestamp('trial_ends_at')->nullable();
$table->timestamp('subscription_ends_at')->nullable();
$table->timestamps();
});
} else {
Schema::table('users', function (Blueprint $table) {
if (!Schema::hasColumn('users', 'name')) {
$table->string('name');
}
if (!Schema::hasColumn('users', 'email')) {
$table->string('email')->unique();
}
if (!Schema::hasColumn('users', 'password')) {
$table->string('password', 60);
}
if (!Schema::hasColumn('users', 'remember_token')) {
$table->rememberToken();
}
if (!Schema::hasColumn('users', 'phone_country_code')) {
$table->string('phone_country_code')->nullable();
}
if (!Schema::hasColumn('users', 'phone_number')) {
$table->string('phone_number')->nullable();
}
if (!Schema::hasColumn('users', 'two_factor_options')) {
$table->text('two_factor_options')->nullable();
}
if (!Schema::hasColumn('users', 'current_team_id')) {
$table->integer('current_team_id')->nullable();
}
if (!Schema::hasColumn('users', 'stripe_active')) {
$table->tinyInteger('stripe_active')->default(0);
}
if (!Schema::hasColumn('users', 'stripe_id')) {
$table->string('stripe_id')->nullable();
}
if (!Schema::hasColumn('users', 'stripe_subscription')) {
$table->string('stripe_subscription')->nullable();
}
if (!Schema::hasColumn('users', 'stripe_plan')) {
$table->string('stripe_plan', 100)->nullable();
}
if (!Schema::hasColumn('users', 'last_four')) {
$table->string('last_four', 4)->nullable();
}
if (!Schema::hasColumn('users', 'extra_billing_info')) {
$table->text('extra_billing_info')->nullable();
}
if (!Schema::hasColumn('users', 'trial_ends_at')) {
$table->timestamp('trial_ends_at')->nullable();
}
if (!Schema::hasColumn('users', 'subscription_ends_at')) {
$table->timestamp('subscription_ends_at')->nullable();
}
if (!Schema::hasColumns('users', ['created_at', 'updated_at'])) {
$table->timestamps();
}
});
}
}
开发者ID:spaceonline,项目名称:laravel-sparkinstaller,代码行数:87,代码来源:2014_10_12_200000_create_or_update_users_table_for_spark.php