本文整理汇总了PHP中Illuminate\Database\Schema\Blueprint::index方法的典型用法代码示例。如果您正苦于以下问题:PHP Blueprint::index方法的具体用法?PHP Blueprint::index怎么用?PHP Blueprint::index使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Schema\Blueprint
的用法示例。
在下文中一共展示了Blueprint::index方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: columns
/**
* Add default nested set columns to the table. Also create an index.
*
* @param \Illuminate\Database\Schema\Blueprint $table
*/
public static function columns(Blueprint $table)
{
$table->unsignedInteger(self::LFT);
$table->unsignedInteger(self::RGT);
$table->unsignedInteger(self::PARENT_ID)->nullable();
$table->index(self::getDefaultColumns());
}
示例2: create
protected function create(Blueprint $table)
{
$table->create();
$table->increments('id');
$table->string('poster', 200)->default('');
$table->integer('poster_id')->unsigned()->default(1);
$table->string('poster_ip', 39)->nullable();
$table->text('message')->nullable();
$table->boolean('hide_smilies')->default(false);
$table->integer('posted')->unsigned()->default(0);
$table->integer('edited')->unsigned()->nullable();
$table->string('edited_by', 200)->nullable();
$table->integer('conversation_id')->unsigned();
$table->index('conversation_id');
$table->index(['poster_id', 'conversation_id']);
}
示例3: _schema_profilemodel
public static function _schema_profilemodel(\Illuminate\Database\Schema\Blueprint $table)
{
$table->unsignedInteger('user_id');
$table->text('avatar');
$table->index(['user_id']);
return $table;
}
示例4: testIndexDefaultNames
public function testIndexDefaultNames()
{
$blueprint = new Blueprint('users');
$blueprint->unique(array('foo', 'bar'));
$commands = $blueprint->getCommands();
$this->assertEquals('users_foo_bar_unique', $commands[0]->index);
$blueprint = new Blueprint('users');
$blueprint->index('foo');
$commands = $blueprint->getCommands();
$this->assertEquals('users_foo_index', $commands[0]->index);
}
示例5: create
protected function create(Blueprint $table)
{
$table->create();
$table->string('id', 40);
$table->integer('user_id')->unsigned()->default(1);
$table->integer('created')->unsigned()->default(0);
$table->integer('last_activity')->unsigned()->default(0);
$table->string('last_ip', 200)->default('0.0.0.0');
$table->text('payload');
$table->primary('id');
$table->index('user_id');
}
示例6: _schema_multiStatusTrait
public static function _schema_multiStatusTrait(\Illuminate\Database\Schema\Blueprint $table)
{
$status = static::$AllowedStatus;
$default = $status[0];
$table->enum('status', $status)->default($default);
if (isset(static::$StatusDateTime)) {
foreach (static::$StatusDateTime as $column) {
if (!in_array($column, ['created_at', 'updated_at', 'deleted_at'])) {
$table->dateTime($column)->nullable();
}
}
}
$table->index(['status']);
return $table;
}
示例7: create
protected function create(Blueprint $table)
{
$table->create();
$table->increments('id');
$table->integer('group_id')->unsigned()->default(3);
$table->string('username', 200)->default('');
$table->string('password', 60)->default('');
$table->string('email', 80)->default('');
$table->string('title', 50)->nullable();
$table->string('realname', 40)->nullable();
$table->string('url', 100)->nullable();
$table->string('location', 30)->nullable();
$table->text('signature')->nullable();
$table->integer('disp_topics')->unsigned()->nullable();
$table->integer('disp_posts')->unsigned()->nullable();
$table->integer('email_setting')->unsigned()->default(1);
$table->boolean('notify_with_post')->default(false);
$table->boolean('auto_notify')->default(false);
$table->boolean('show_smilies')->default(true);
$table->boolean('show_img')->default(true);
$table->boolean('show_img_sig')->default(true);
$table->boolean('show_avatars')->default(true);
$table->boolean('show_sig')->default(true);
$table->float('timezone')->default(0);
$table->boolean('dst')->default(false);
$table->integer('time_format')->unsigned()->default(0);
$table->integer('date_format')->unsigned()->default(0);
$table->string('language', 25)->default('');
$table->string('style', 25)->default('');
$table->integer('num_posts')->unsigned()->default(0);
$table->integer('last_post')->unsigned()->nullable();
$table->integer('last_search')->unsigned()->nullable();
$table->integer('last_email_sent')->unsigned()->nullable();
$table->integer('last_report_sent')->unsigned()->nullable();
$table->integer('registered')->unsigned()->default(0);
$table->string('registration_ip', 35)->default('0.0.0.0');
$table->integer('last_visit')->unsigned()->default(0);
$table->string('admin_note', 30)->nullable();
$table->string('activate_string', 80)->nullable();
$table->string('activate_key', 8)->nullable();
$table->string('remember_token')->nullable();
$table->unique('username');
$table->index('registered');
}
示例8: documentSchema
/**
* @param Blueprint $table table
* @return Blueprint
*/
private function documentSchema(Blueprint $table)
{
$table->string('parentId', 255)->default('');
$table->string('instanceId', 255)->default('');
// users
$table->string('userType', '16')->default('normal');
$table->string('userId', 255);
$table->string('writer', 255);
$table->string('email')->nullable();
// 비회원 작성일때 email 받기?
$table->string('certifyKey', 255);
// nonmember document's password
// count
$table->integer('readCount')->default(0);
$table->integer('commentCount')->default(0);
$table->integer('assentCount')->default(0);
$table->integer('dissentCount')->default(0);
// display contents config values
$table->enum('approved', array('approved', 'waiting', 'rejected'))->default('approved');
$table->enum('published', array('published', 'waiting', 'reserved', 'rejected'))->default('published');
// temp 대신 draft가 어떨까?
$table->enum('status', array('public', 'temp', 'trash', 'private', 'notice'))->default('public');
$table->enum('display', array('visible', 'secret', 'hidden'))->default('visible');
// search
$table->string('locale', 255)->default('');
// multi-language support. ko, en, jp, ...
$table->string('title', 255);
$table->text('content');
$table->text('pureContent');
$table->timestamp('createdAt');
$table->timestamp('publishedAt');
$table->timestamp('updatedAt');
$table->timestamp('deletedAt')->nullable();
// 대댓글 처리를 위한 트리용 컬럼 추가 ex.) head, parent, depth
$table->string('head', 50);
// timestamp + uuid (ex. 1430369257-bd1fc797-474f-47a6-bedb-867a376490f2)
$table->string('reply', 200)->nullable();
$table->string('listOrder', 250);
$table->string('ipaddress', 16);
$table->index('createdAt');
$table->unique(['head', 'reply']);
return $table;
}
示例9: index
/**
* Criar indice, respeitando se deve ou nao adicionar o inquilno.
*/
public function index($columns, $name = null, $withTenant = false)
{
$columns = (array) $columns;
// Verificar se deve adicionar a coluna do inquilino
if ($withTenant && in_array(self::tenantField(), $columns) != true) {
$columns = array_merge([], [self::tenantField()], $columns);
}
return parent::index($columns, $name);
}
示例10: testAddingIndex
public function testAddingIndex()
{
$blueprint = new Blueprint('users');
$blueprint->index(array('foo', 'bar'), 'baz');
$statements = $blueprint->toSql($this->getGrammar());
$this->assertEquals(1, count($statements));
$this->assertEquals('create index baz on "users" ("foo", "bar")', $statements[0]);
}
示例11: _schema_switchableTable
public static function _schema_switchableTable(\Illuminate\Database\Schema\Blueprint $table)
{
$table->enum('switch', ['启用', '禁用']);
$table->index(['switch']);
return $table;
}
示例12: testAddingIndex
public function testAddingIndex()
{
$blueprint = new Blueprint('users');
$blueprint->index(['foo', 'bar'], 'baz');
$statements = $blueprint->toSql($this->getConnection(), $this->getGrammar());
$this->assertEquals(1, count($statements));
$this->assertEquals('create index baz on users ( foo, bar )', $statements[0]);
}
示例13: setColumns
/**
* @param Blueprint $table table
* @return Blueprint
*/
private function setColumns(Blueprint $table)
{
$table->string('parentId', 255)->default('');
$table->string('instanceId', 255)->default('');
$table->string('type', 255)->default('');
// users
$table->string('userType', '16')->default('normal');
$table->string('userId', 255);
$table->string('writer', 255);
$table->string('email')->nullable();
// 비회원 작성일때 email 받기?
$table->string('certifyKey', 255);
// nonmember document's password
// count
$table->integer('readCount')->default(0);
$table->integer('commentCount')->default(0);
$table->integer('assentCount')->default(0);
$table->integer('dissentCount')->default(0);
// display contents config values
$table->integer('approved')->default(Document::APPROVED_APPROVED);
$table->integer('published')->default(Document::PUBLISHED_PUBLISHED);
$table->integer('status')->default(Document::STATUS_PUBLIC);
$table->integer('display')->default(Document::DISPLAY_VISIBLE);
$table->integer('format')->default(Document::FORMAT_HTML);
// search
$table->string('locale', 255)->default('');
$table->string('title', 255);
$table->text('content');
$table->text('pureContent');
$table->timestamp('createdAt');
$table->timestamp('updatedAt');
$table->timestamp('publishedAt')->nullable();
$table->timestamp('deletedAt')->nullable();
$table->string('head', 50);
$table->string('reply', 200);
$table->string('ipaddress', 16);
$table->index('createdAt');
$table->unique(['head', 'reply']);
return $table;
}