当前位置: 首页>>代码示例>>PHP>>正文


PHP Builder::getConnection方法代码示例

本文整理汇总了PHP中Illuminate\Database\Schema\Builder::getConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP Builder::getConnection方法的具体用法?PHP Builder::getConnection怎么用?PHP Builder::getConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Database\Schema\Builder的用法示例。


在下文中一共展示了Builder::getConnection方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateColumn

 /**
  * Update the field type column to the table.
  *
  * @param Blueprint           $table
  * @param AssignmentInterface $assignment
  */
 public function updateColumn(Blueprint $table, AssignmentInterface $assignment)
 {
     // Skip if no column type.
     if (!$this->fieldType->getColumnType()) {
         return;
     }
     // Skip if the column doesn't exists.
     if (!$this->schema->hasColumn($table->getTable(), $this->fieldType->getColumnName())) {
         return;
     }
     /**
      * Update the column to the table.
      *
      * @var Blueprint|Fluent $column
      */
     $column = call_user_func_array([$table, $this->fieldType->getColumnType()], array_filter([$this->fieldType->getColumnName(), $this->fieldType->getColumnLength()]));
     $column->nullable(!$assignment->isTranslatable() ? !$assignment->isRequired() : true)->change();
     if (!str_contains($this->fieldType->getColumnType(), ['text', 'blob'])) {
         $column->default(array_get($this->fieldType->getConfig(), 'default_value'));
     }
     /**
      * Mark the column unique if desired and not translatable.
      * Otherwise, drop the unique index.
      */
     $connection = $this->schema->getConnection();
     $manager = $connection->getDoctrineSchemaManager();
     $doctrine = $manager->listTableDetails($connection->getTablePrefix() . $table->getTable());
     // The unique index name.
     $unique = md5('unique_' . $this->fieldType->getColumnName());
     /**
      * If the assignment is unique and not translatable
      * and the table does not already have the given the
      * given table index then go ahead and add it.
      */
     if ($assignment->isUnique() && !$assignment->isTranslatable() && !$doctrine->hasIndex($unique)) {
         $table->unique($this->fieldType->getColumnName(), $unique);
     }
     /**
      * If the assignment is NOT unique and not translatable
      * and the table DOES have the given table index
      * then we need to remove.
      */
     if (!$assignment->isUnique() && !$assignment->isTranslatable() && $doctrine->hasIndex($unique)) {
         $column->dropIndex(md5('unique_' . $this->fieldType->getColumnName()));
     }
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:52,代码来源:FieldTypeSchema.php

示例2: getConnection

 /**
  * Get the database connection instance.
  *
  * @return \Illuminate\Database\Connection 
  * @static 
  */
 public static function getConnection()
 {
     return \Illuminate\Database\Schema\Builder::getConnection();
 }
开发者ID:poovarasanvasudevan,项目名称:voice-app,代码行数:10,代码来源:_ide_helper.php

示例3: getConnection

 /**
  * Get the database connection instance.
  *
  * @return \Illuminate\Database\Connection
  */
 public function getConnection()
 {
     return static::$schema->getConnection();
 }
开发者ID:formula9,项目名称:framework,代码行数:9,代码来源:Schema.php

示例4: __construct

 /**
  * @param ApplicationContract $app
  * @param BaseBuilder $base
  */
 public function __construct(ApplicationContract $app, BaseBuilder $base)
 {
     parent::__construct($base->getConnection());
 }
开发者ID:ooxif,项目名称:laravel-spec-schema,代码行数:8,代码来源:Builder.php


注:本文中的Illuminate\Database\Schema\Builder::getConnection方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。