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


PHP Blueprint::timestamps方法代碼示例

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


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

示例1: timestamps

 /**
  * 
  * @return $this
  */
 public function timestamps($timestamps = true)
 {
     $this->timestamps = $timestamps;
     if ($timestamps && !Schema::hasTable($this->table)) {
         $this->blueprint->timestamps();
     }
     return $this;
 }
開發者ID:boyhagemann,項目名稱:framework,代碼行數:12,代碼來源:ModelBuilder.php

示例2: create

 /**
  * Create the table schema.
  *
  * @param Blueprint $table
  *
  * @return mixed
  */
 protected function create(Blueprint $table)
 {
     $table->increments('id');
     $table->unsignedInteger('job_id');
     $table->string('name');
     $table->unique(['job_id', 'name']);
     $table->timestamps();
 }
開發者ID:MarkVaughn,項目名稱:illuminated,代碼行數:15,代碼來源:CreateJobTagsTable.php

示例3: create

 protected function create(Blueprint $table)
 {
     $table->create();
     $table->string('slug', 100)->primary();
     $table->string('name');
     $table->integer('position')->default(0);
     $table->boolean('conversations_enabled')->default(true);
     $table->timestamps();
 }
開發者ID:fluxbb,項目名稱:core,代碼行數:9,代碼來源:Categories.php

示例4: create

 /**
  * Create the table schema.
  *
  * @param Blueprint $table
  *
  * @return mixed
  */
 protected function create(Blueprint $table)
 {
     $table->increments('id');
     $table->text('public_id');
     $table->text('secret_key');
     $table->string('type');
     $table->text('data');
     $table->timestamps();
 }
開發者ID:MarkVaughn,項目名稱:illuminated,代碼行數:16,代碼來源:CreateKeyPairTable.php

示例5: buildDynamicTable

 protected function buildDynamicTable(Blueprint $table)
 {
     $reference_column = $this->getDynamicType() . '_id';
     $reference_table = $this->getDynamicType() . 's';
     $reference_index = 'FK_' . $this->getDynamicTableName() . '_' . $reference_column . '_' . $reference_table;
     $table->increments('id');
     $table->integer($reference_column)->unsigned()->nullable();
     $table->foreign($reference_column, $reference_index)->references('id')->on($reference_table)->onUpdate('CASCADE')->onDelete('SET NULL');
     $table->timestamps();
 }
開發者ID:sodacms,項目名稱:sodacms,代碼行數:10,代碼來源:AbstractDynamicType.php

示例6: buildDynamicTable

 protected function buildDynamicTable(Blueprint $table)
 {
     $block_index = 'FK_' . $this->getDynamicTableName() . '_block_id_blocks';
     $page_index = 'FK_' . $this->getDynamicTableName() . '_page_id_pages';
     $table->increments('id');
     $table->integer('block_id')->unsigned()->nullable();
     $table->integer('page_id')->unsigned()->nullable();
     $table->integer('is_shared')->unsigned()->nullable();
     $table->foreign('block_id', $block_index)->references('id')->on('blocks')->onUpdate('CASCADE')->onDelete('SET NULL');
     $table->foreign('page_id', $page_index)->references('id')->on('pages')->onUpdate('CASCADE')->onDelete('SET NULL');
     $table->timestamps();
 }
開發者ID:sodacms,項目名稱:sodacms,代碼行數:12,代碼來源:BlockType.php

示例7: create

 /**
  * Create the table schema.
  *
  * @param Blueprint $table
  *
  * @return mixed
  */
 protected function create(Blueprint $table)
 {
     $table->increments('id');
     $table->string('task');
     $table->text('data')->nullable();
     $table->string('state')->default(JobState::IDLE);
     $table->text('message')->nullable();
     $table->boolean('schedulable')->default(false);
     $table->integer('attempts')->default(0);
     $table->integer('retries')->default(0);
     $table->timestamp('started_at')->nullable();
     $table->timestamp('completed_at')->nullable();
     $table->timestamp('expires_at')->nullable();
     $table->timestamp('run_at')->nullable();
     $table->timestamps();
 }
開發者ID:MarkVaughn,項目名稱:illuminated,代碼行數:23,代碼來源:CreateJobsTable.php

示例8: create

 protected function create(Blueprint $table)
 {
     $table->create();
     $table->increments('id');
     $table->string('category_slug', 100)->nullable()->index();
     $table->string('title');
     $table->string('poster', 200)->default('');
     $table->integer('posted')->unsigned()->default(0);
     $table->integer('first_post_id')->unsigned()->default(0);
     $table->integer('last_post')->unsigned()->default(0);
     $table->integer('last_post_id')->unsigned()->default(0);
     $table->string('last_poster', 200)->nullable();
     $table->integer('num_views')->unsigned()->default(0);
     $table->integer('num_replies')->unsigned()->default(0);
     $table->timestamps();
 }
開發者ID:fluxbb,項目名稱:core,代碼行數:16,代碼來源:Conversations.php

示例9: ifNoUsersTable

 private function ifNoUsersTable(Blueprint $table)
 {
     $table->increments('id');
     $table->string('first_name');
     $table->string('last_name');
     $table->string('email')->unique();
     $table->string('avatar');
     $table->string('provider');
     $table->string('provider_id')->unique();
     $table->longText('provider_token');
     $table->string('password', 60)->nullable();
     $table->boolean('verified')->default(false);
     $table->string('gender')->nullable();
     $table->string('link');
     $table->rememberToken();
     $table->timestamps();
 }
開發者ID:jayaregalinada,項目名稱:common,代碼行數:17,代碼來源:common_create_users_table.php

示例10: testAddingTimeStamps

 public function testAddingTimeStamps()
 {
     $blueprint = new Blueprint('users');
     $blueprint->timestamps();
     $statements = $blueprint->toSql($this->getGrammar());
     $this->assertEquals(1, count($statements));
     $this->assertEquals('alter table "users" add "created_at" datetime not null, add "updated_at" datetime not null', $statements[0]);
 }
開發者ID:hochanh,項目名稱:Bootsoft-Bowling,代碼行數:8,代碼來源:SqlServerSchemaGrammarTest.php

示例11: testAddingTimeStamps

 public function testAddingTimeStamps()
 {
     $blueprint = new Blueprint('users');
     $blueprint->timestamps();
     $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
     $this->assertEquals(1, count($statements));
     $this->assertEquals('alter table users add ( created_at timestamp default 0 not null, updated_at timestamp default 0 not null )', $statements[0]);
 }
開發者ID:mickael83,項目名稱:Laravel-OracleDB,代碼行數:8,代碼來源:OracleDBSchemaGrammarTest.php

示例12: buildBlueprints

 /**
  * @return array
  */
 public function buildBlueprints()
 {
     $blueprint = new Blueprint($this->table);
     if (!Schema::hasTable($this->table)) {
         $blueprint->increments('id');
         if ($this->timestamps) {
             $blueprint->timestamps();
         }
     }
     $blueprints[] = $blueprint;
     // Only add column that doesn't exist in the database yet
     foreach ($this->columns as $name => $column) {
         if (!Schema::hasColumn($this->table, $name)) {
             $blueprint->{$column->getType()}($name);
         }
     }
     foreach ($this->relations as $relation) {
         if ($relation->hasPivotTable()) {
             $table = $relation->getBlueprint()->getTable();
             if (!Schema::hasTable($table)) {
                 $blueprints[] = $relation->getBlueprint();
             }
         } else {
             if (!Schema::hasColumn($this->table, $relation->getColumn())) {
                 $blueprint->integer($relation->getColumn());
             }
         }
     }
     return $blueprints;
 }
開發者ID:boyhagemann,項目名稱:model,代碼行數:33,代碼來源:ModelBuilder.php

示例13: activate

 /**
  * Creates the table.
  *
  * @param \Illuminate\Database\Schema\Blueprint $table
  */
 public function activate(Blueprint $table)
 {
     $table->increments('id');
     $table->string('address', 100);
     $table->timestamps();
 }
開發者ID:PrafullaKumarSahu,項目名稱:example-plugin,代碼行數:11,代碼來源:Access.php


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