本文整理匯總了PHP中Illuminate\Database\Schema\Blueprint::addColumn方法的典型用法代碼示例。如果您正苦於以下問題:PHP Blueprint::addColumn方法的具體用法?PHP Blueprint::addColumn怎麽用?PHP Blueprint::addColumn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Illuminate\Database\Schema\Blueprint
的用法示例。
在下文中一共展示了Blueprint::addColumn方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: addColumn
/**
* Add column only if there isn't one.
* So it will not throw if there already exists.
*/
public function addColumn($type, $column, array $parameters = array())
{
// check against existing
if (!$this->builder->hasColumn($this->table, $column)) {
return parent::addColumn($type, $column, $parameters);
}
// else probably compare and do some alteration
}
示例2: addColumn
/**
* Do not allow creating of fields like _id, _score, _version
*/
protected function addColumn($type, $name, array $parameters = [])
{
if (in_array($name, ['_id', '_score', '_version'])) {
throw new NotImplementedException("Naming column as '{$name}' is not supported.");
}
return parent::addColumn($type, $name, $parameters);
}
示例3: addColumn
public function addColumn($type, $name, array $parameters = [])
{
return parent::addColumn($type, $name, $parameters);
}
示例4: addI18NColumn
/**
* @param string $type
* @param string $name
* @param array $parameters
*
* @return Fluent
*/
public function addI18NColumn($type, $name, array $parameters = [])
{
$this->i18n_columns[] = $column = parent::addColumn($type, $name, $parameters);
return $column;
}