當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。