當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Connection::getSchemaBuilder方法代碼示例

本文整理匯總了PHP中Illuminate\Database\Connection::getSchemaBuilder方法的典型用法代碼示例。如果您正苦於以下問題:PHP Connection::getSchemaBuilder方法的具體用法?PHP Connection::getSchemaBuilder怎麽用?PHP Connection::getSchemaBuilder使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Database\Connection的用法示例。


在下文中一共展示了Connection::getSchemaBuilder方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: __construct

 /**
  * Create a new FieldTypeSchema instance.
  *
  * @param FieldType  $fieldType
  * @param Repository $cache
  */
 public function __construct(FieldType $fieldType, Container $container, Repository $cache)
 {
     $this->cache = $cache;
     $this->container = $container;
     $this->fieldType = $fieldType;
     $this->connection = $container->make('db')->connection();
     $this->schema = $this->connection->getSchemaBuilder();
 }
開發者ID:huglester,項目名稱:streams-platform,代碼行數:14,代碼來源:FieldTypeSchema.php

示例2: version

 /**
  * {@inheritdoc}
  */
 public function version($id)
 {
     $schema = $this->connection->getSchemaBuilder();
     if (!$schema->hasTable($this->tableName)) {
         return null;
     }
     $version = $this->connection->table($this->tableName)->where('version', $id)->first();
     if ($version) {
         return (array) $version;
     }
     return null;
 }
開發者ID:wandu,項目名稱:framework,代碼行數:15,代碼來源:MigrateAdapter.php

示例3: createSchema

 /**
  * Create Schema
  *
  * @return AdapterInterface
  */
 public function createSchema()
 {
     /* @var \Illuminate\Database\Schema\Blueprint $table */
     $this->adapter->getSchemaBuilder()->create($this->tableName, function ($table) {
         $table->string('version');
     });
 }
開發者ID:davedevelopment,項目名稱:phpmig,代碼行數:12,代碼來源:Database.php

示例4: getSchemaBuilder

 /**
  * Retrieve the schema builder for the database connection. And set a custom blueprint resolver to return an
  * instance of the Culpa Blueprint class.
  *
  * @param Connection $connection
  * @return \Illuminate\Database\Schema\Builder
  */
 protected static function getSchemaBuilder(Connection $connection)
 {
     $schemaBuilder = $connection->getSchemaBuilder();
     $schemaBuilder->blueprintResolver(function ($table, $callback) {
         return new Blueprint($table, $callback);
     });
     return $schemaBuilder;
 }
開發者ID:nstapelbroek,項目名稱:culpa-laravel-5,代碼行數:15,代碼來源:Schema.php

示例5: getSchemaBuilder

 public function getSchemaBuilder()
 {
     if (empty($this->builder)) {
         return parent::getSchemaBuilder();
     }
     $class = $this->builder;
     return new $class($this);
 }
開發者ID:bapcat,項目名稱:remodel,代碼行數:8,代碼來源:RemodelConnection.php

示例6: initialize

 /**
  * @param \Illuminate\Database\Connection $db
  */
 public function initialize(Connection $db)
 {
     $builder = $db->getSchemaBuilder();
     $tables = ['networks' => function (Blueprint $table) {
         $table->increments('id');
         $table->string('server');
         $table->unique(['server']);
     }, 'channels' => function (Blueprint $table) {
         $table->increments('id');
         $table->integer('network_id')->unsigned();
         $table->string('channel');
         $table->unique(['network_id', 'channel']);
         $table->foreign('network_id')->references('id')->on('networks');
     }, 'nicks' => function (Blueprint $table) {
         $table->increments('id');
         $table->integer('network_id')->unsigned();
         $table->string('nick');
         $table->unique(['network_id', 'nick']);
         $table->foreign('network_id')->references('id')->on('networks');
     }, 'logs' => function (Blueprint $table) {
         $table->increments('id');
         $table->integer('channel_id')->unsigned();
         $table->integer('nick_id')->unsigned();
         $table->timestamp('timestamp');
         $table->text('message');
         $table->foreign('channel_id')->references('id')->on('channels');
         $table->foreign('nick_id')->references('id')->on('nicks');
     }, 'words' => function (Blueprint $table) {
         $table->increments('id');
         $table->string('word', 40);
     }, 'logs_words' => function (Blueprint $table) {
         $table->increments('id');
         $table->integer('logs_id')->unsigned();
         $table->integer('word_id')->unsigned();
         $table->foreign('logs_id')->references('id')->on('logs');
         $table->foreign('word_id')->references('id')->on('words');
     }];
     foreach ($tables as $table => $callback) {
         if ($builder->hasTable($table)) {
             continue;
         }
         $builder->create($table, $callback);
     }
 }
開發者ID:tomzx,項目名稱:irc-stats,代碼行數:47,代碼來源:DatabaseSchema.php

示例7: __construct

 /**
  * Preparar Migration.
  */
 public function __construct()
 {
     $this->con = app('db')->connection($this->getConnection());
     $this->builder = $this->con->getSchemaBuilder();
     $this->grammar = $this->con->getSchemaGrammar();
 }
開發者ID:bugotech,項目名稱:database,代碼行數:9,代碼來源:Migration.php

示例8: __construct

 /**
  * Construct an instance of a BaseMigration.
  */
 public function __construct()
 {
     $this->db = app('db')->connection($this->connection);
     $this->builder = $this->db->getSchemaBuilder();
 }
開發者ID:MarkVaughn,項目名稱:illuminated,代碼行數:8,代碼來源:BaseMigration.php

示例9: tearDown

 public function tearDown()
 {
     $this->connection->getSchemaBuilder()->dropIfExists('riders');
     $this->connection->getSchemaBuilder()->dropIfExists('classes');
 }
開發者ID:shin1x1,項目名稱:laravel-table-admin,代碼行數:5,代碼來源:AbstractColumnCollectionFactoryTest.php

示例10: build

 /**
  * Overrride build function
  *
  * @param Connection $connection
  * @param Grammar    $grammar
  */
 public function build(Connection $connection, Grammar $grammar)
 {
     $command = $this->parseCommand($this->commands[0]->get('name'));
     $schema = $connection->getSchemaBuilder();
     if ($command === "drop") {
         $schema->dropIfExists($this->getI18NTableName());
     }
     parent::build($connection, $grammar);
     if ($command === "create") {
         $primary = $this->i18n_primary;
         $i18n_columns = $this->i18n_columns;
         $table_name = $this->table;
         $schema->create($this->getI18NTableName(), function (Blueprint $table) use($table_name, $primary, $i18n_columns) {
             foreach ($primary as $name => $col) {
                 $table->columns[] = $col;
                 $table->foreign($col->get('name'))->references($col->get('name'))->on($table_name)->onDelete('cascade');
             }
             foreach ($i18n_columns as $col) {
                 $table->columns[] = $col;
             }
             $table->string($this->i18n_code_field, 10);
             $table->primary(array_merge(array_keys($primary), [$this->i18n_code_field]));
         });
     }
 }
開發者ID:tuanlq11,項目名稱:dbi18n,代碼行數:31,代碼來源:I18NBlueprint.php

示例11: __construct

 public function __construct(Illuminate\Database\Connection $connection = NULL)
 {
     static::$connection = $connection ?: Forge::find('db.connection');
     static::$schema = static::$connection->getSchemaBuilder();
     static::$instance = $this;
 }
開發者ID:formula9,項目名稱:framework,代碼行數:6,代碼來源:Schema.php


注:本文中的Illuminate\Database\Connection::getSchemaBuilder方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。