当前位置: 首页>>代码示例>>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;未经允许,请勿转载。