本文整理汇总了PHP中Illuminate\Database\Schema\Blueprint::dropColumn方法的典型用法代码示例。如果您正苦于以下问题:PHP Blueprint::dropColumn方法的具体用法?PHP Blueprint::dropColumn怎么用?PHP Blueprint::dropColumn使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Schema\Blueprint
的用法示例。
在下文中一共展示了Blueprint::dropColumn方法的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testDropColumn
public function testDropColumn()
{
$blueprint = new Blueprint('users');
$blueprint->dropColumn('foo');
$statements = $blueprint->toSql($this->getGrammar());
$this->assertEquals(1, count($statements));
$this->assertEquals('alter table "users" drop "foo"', $statements[0]);
$blueprint = new Blueprint('users');
$blueprint->dropColumn(array('foo', 'bar'));
$statements = $blueprint->toSql($this->getGrammar());
$this->assertEquals(1, count($statements));
$this->assertEquals('alter table "users" drop "foo", drop "bar"', $statements[0]);
}
示例2: ifUsersTableExists
protected function ifUsersTableExists(Blueprint $table)
{
if (Schema::hasColumn('users', 'name')) {
$table->dropColumn('name');
}
$table->string('last_name')->after('id');
$table->string('first_name')->after('id');
$table->string('avatar')->after('email');
$table->string('provider')->after('email');
$table->string('provider_id')->unique()->after('email');
$table->longText('provider_token')->after('email');
$table->string('link')->after('password');
$table->string('gender')->nullable()->after('password');
$table->boolean('verified')->default(false)->after('password');
}
示例3: dropColumn
/**
* Excluir campo.
*
* @param string|array $columns
*
* @return \Illuminate\Support\Fluent
*/
public function dropColumn($columns)
{
$columns = is_array($columns) ? $columns : (array) func_get_args();
// Verificar se deve excluir constrain dos campos lookups antes
foreach ($columns as $column) {
if (ForeignKey::isAssociation($column)) {
parent::dropForeign(ForeignKey::makeName($this->table, $column));
}
}
return parent::dropColumn($columns);
}
示例4: dropColumns
/**
* Drop NestedSet columns.
*
* @param \Illuminate\Database\Schema\Blueprint $table
*/
public static function dropColumns(Blueprint $table)
{
$columns = self::getDefaultColumns();
$table->dropIndex($columns);
$table->dropColumn($columns);
}
示例5: drop
/**
* 컬럼 제거
*
* @param \Illuminate\Database\Schema\Blueprint $table schema builder
* @param string $prefix column 이름 앞에 붙일 문자열
* @return void
*/
public function drop(Blueprint $table, $prefix = '')
{
$table->dropColumn(camel_case($prefix . $this->__get('name')));
}
示例6: onDatabaseDrop
/**
* @param Blueprint $table
*/
public function onDatabaseDrop(Blueprint $table)
{
$table->dropColumn($this->getDBKey());
}
示例7: dropColumn
/**
* Drop the field type column.
*
* @param Blueprint $table
*/
public function dropColumn(Blueprint $table)
{
$table->dropColumn($this->fieldType->getColumnName() . '_type');
$table->dropColumn($this->fieldType->getColumnName() . '_id');
}
示例8: dropColumn
/**
* Drop the field type column from the table.
*
* @param Blueprint $table
*/
public function dropColumn(Blueprint $table)
{
// Skip if no column type.
if (!$this->fieldType->getColumnType()) {
return;
}
// Skip if the column doesn't exist.
if (!$this->schema->hasColumn($table->getTable(), $this->fieldType->getColumnName())) {
return;
}
// Drop dat 'ole column.
$table->dropColumn($this->fieldType->getColumnName());
}
示例9: testDropColumn
public function testDropColumn()
{
$blueprint = new Blueprint('users');
$blueprint->dropColumn('foo');
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertEquals(1, count($statements));
$this->assertEquals('alter table users drop ( foo )', $statements[0]);
$blueprint = new Blueprint('users');
$blueprint->dropColumn(['foo', 'bar']);
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertEquals(1, count($statements));
$this->assertEquals('alter table users drop ( foo, bar )', $statements[0]);
}
示例10: testDropColumn
/**
* @expectedException BadMethodCallException
*/
public function testDropColumn()
{
$blueprint = new Blueprint('users');
$blueprint->dropColumn('foo');
$statements = $blueprint->toSql($this->getGrammar());
}
示例11: removeFromModel
/**
* Removes column for this field from our DynamicModel
*
* @param \Illuminate\Database\Schema\Blueprint $table
*
* @return $this
*/
public function removeFromModel(Blueprint $table)
{
$table->dropColumn($this->getFieldName());
return $this;
}