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


PHP Builder::hasColumn方法代码示例

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


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

示例1: 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());
 }
开发者ID:jacksun101,项目名称:streams-platform,代码行数:18,代码来源:FieldTypeSchema.php

示例2: restoreColumn

 /**
  * Restore the field type column to cache.
  *
  * @param Blueprint $table
  */
 public function restoreColumn(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;
     }
     // Translatable or no?
     $translatable = ends_with($table->getTable(), '_translations');
     // Restore the data.
     $results = $this->cache->get(__CLASS__ . $this->fieldType->getColumnName());
     foreach ($results as $result) {
         $result = (array) $result;
         $this->connection->table($table->getTable())->where($translatable ? 'entry_id' : 'id', array_pull($result, 'id'))->update($result);
     }
     $this->cache->forget(__CLASS__ . $this->fieldType->getColumnName());
 }
开发者ID:huglester,项目名称:streams-platform,代码行数:25,代码来源:FieldTypeSchema.php

示例3: testBlameableConfigurable

 /**
  * In addition to the testBleamble() test, you can configure what fields you want generated.
  */
 public function testBlameableConfigurable()
 {
     $this->schemaBuilder->create($this->tableName, function (Blueprint $table) {
         $table->blameable(['created']);
     });
     $this->assertTrue($this->schemaBuilder->hasColumn($this->tableName, 'created_by'));
     $this->assertFalse($this->schemaBuilder->hasColumn($this->tableName, 'updated_by'));
     $this->assertFalse($this->schemaBuilder->hasColumn($this->tableName, 'deleted_by'));
     $this->schemaBuilder->drop($this->tableName);
     $this->schemaBuilder->create($this->tableName, function (Blueprint $table) {
         $table->blameable(['created', 'updated']);
     });
     $this->assertTrue($this->schemaBuilder->hasColumn($this->tableName, 'created_by'));
     $this->assertTrue($this->schemaBuilder->hasColumn($this->tableName, 'updated_by'));
     $this->assertFalse($this->schemaBuilder->hasColumn($this->tableName, 'deleted_by'));
     $this->schemaBuilder->drop($this->tableName);
     $this->schemaBuilder->create($this->tableName, function (Blueprint $table) {
         $table->blameable(['deleted', 'updated']);
     });
     $this->assertFalse($this->schemaBuilder->hasColumn($this->tableName, 'created_by'));
     $this->assertTrue($this->schemaBuilder->hasColumn($this->tableName, 'updated_by'));
     $this->assertTrue($this->schemaBuilder->hasColumn($this->tableName, 'deleted_by'));
 }
开发者ID:nstapelbroek,项目名称:culpa-laravel-5,代码行数:26,代码来源:SchemaBlueprintTest.php

示例4: hasColumn

 /**
  * Determine if the given table has a given column.
  *
  * @param string $table
  * @param string $column
  * @return bool 
  * @static 
  */
 public static function hasColumn($table, $column)
 {
     return \Illuminate\Database\Schema\Builder::hasColumn($table, $column);
 }
开发者ID:poovarasanvasudevan,项目名称:voice-app,代码行数:12,代码来源:_ide_helper.php

示例5: hasColumn

 /**
  * Check if the given model talbe has the given column.
  *
  * @param  \Illuminate\Contracts\Auth\Authenticatable  $user
  * @param  string  $column
  * @return bool
  */
 protected function hasColumn(AuthenticatableContract $user, $column)
 {
     return $this->schema->hasColumn($user->getTable(), $column);
 }
开发者ID:jrean,项目名称:laravel-user-verification,代码行数:11,代码来源:UserVerification.php

示例6: hasColumn

 /**
  * Determine if the given table has a given column.
  *
  * @param  string $table
  * @param  string $column
  *
  * @return bool
  */
 public function hasColumn($table, $column)
 {
     return static::$schema->hasColumn($table, $column);
 }
开发者ID:formula9,项目名称:framework,代码行数:12,代码来源:Schema.php


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