本文整理汇总了PHP中Illuminate\Database\Schema\Blueprint类的典型用法代码示例。如果您正苦于以下问题:PHP Blueprint类的具体用法?PHP Blueprint怎么用?PHP Blueprint使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Blueprint类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _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;
}
示例2: create
protected function create(Blueprint $table)
{
$table->create();
$table->string('conf_name', 255)->default('');
$table->text('conf_value')->nullable();
$table->primary('conf_name');
}
示例3: _schema_tagModel
public static function _schema_tagModel(\Illuminate\Database\Schema\Blueprint $table)
{
$table->text('name')->nullable();
$table->string('type')->default('default');
$table->morphs('taggable');
return $table;
}
示例4: create
protected function create(Blueprint $table)
{
$table->create();
$table->integer('user_id')->unsigned();
$table->integer('topic_id')->unsigned();
$table->primary(array('user_id', 'topic_id'));
}
示例5: create
protected function create(Blueprint $table)
{
$table->create();
$table->increments('id');
$table->string('title', 50)->default('');
$table->integer('parent_group_id')->unsigned()->nullable();
}
示例6: addConfirmationColumns
/**
* Add confirmation columns.
*
* @param \Illuminate\Database\Schema\Blueprint $table
*/
private function addConfirmationColumns(Blueprint $table)
{
if (UserConfirmator::isEnabled()) {
$table->boolean('is_confirmed')->default(0);
$table->string('confirmation_code', UserConfirmator::getLength())->nullable();
$table->timestamp('confirmed_at')->nullable();
}
}
示例7: build
/**
* Execute the blueprint to build / modify the table.
*
* @param \Cooperl\Database\DB2\Schema\Blueprint $blueprint
* @return void
*/
protected function build(Blueprint $blueprint)
{
$schemaTable = explode(".", $blueprint->getTable());
if (count($schemaTable) > 1) {
$this->connection->setCurrentSchema($schemaTable[0]);
}
$blueprint->build($this->connection, $this->grammar);
$this->connection->resetCurrentSchema();
}
示例8: getInheritedTables
/**
* Compile the blueprint's inherits definitions.
*
* @param BaseBlueprint $blueprint
* @return array
*/
protected function getInheritedTables(BaseBlueprint $blueprint)
{
$tables = [];
foreach ($blueprint->getInheritedTables() as $table) {
//$sql = $this->wrapTable($table);
$tables[] = $table;
}
return $tables;
}
示例9: 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();
}
示例10: 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);
}
示例11: 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');
}
示例12: getQualifiedAutoIncrementColumn
/**
* get qualified autoincrement column
*
* @param Blueprint $blueprint
* @return Fluent|null
*/
public function getQualifiedAutoIncrementColumn(Blueprint $blueprint)
{
$columns = $blueprint->getColumns();
// search for primary key / autoIncrement column
foreach ($columns as $column) {
// if column is autoIncrement set the primary col name
if ($column->autoIncrement) {
return $column;
}
}
return null;
}
示例13: _schema_LoginableTrait
/**
* @param Blueprint $table
* @return Blueprint
*/
public static function _schema_LoginableTrait(Blueprint $table)
{
$table->string('password')->nullable();
$table->rememberToken('remember_token');
$table->dateTime('last_login')->nullable();
$table->string('last_ip')->nullable();
$table->integer('fails')->default(0);
$table->enum('is_banned', [0, 1])->default(0);
$table->text('ban_reason')->nullable();
$table->enum('locked_screen', [0, 1])->default(0);
return $table;
}
示例14: describeSchema
/**
* Give me the tools and I will tell you what my schema is...
*
* @param Blueprint $table The blueprint for the database table.
* @return Blueprint The designed database table schema.
*/
public static function describeSchema(Blueprint $table)
{
$table->increments('id');
$table->string('uuid', 36);
$table->integer('playhead')->unsigned();
$table->text('metadata');
$table->text('payload');
$table->string('recorded_on', 32);
$table->text('type');
$table->unique(['uuid', 'playhead']);
return $table;
}
示例15: getBlueprint
/**
* @return Blueprint|null
*/
public function getBlueprint()
{
if ($this->hasPivotTable()) {
$left = $this->buildLeftColumnName();
$right = $this->getColumn();
$table = $this->getTable();
$blueprint = new Blueprint($table);
$blueprint->increments('id');
$blueprint->integer($left);
$blueprint->integer($right);
return $blueprint;
}
}