本文整理汇总了PHP中Illuminate\Support\Facades\Schema::connection方法的典型用法代码示例。如果您正苦于以下问题:PHP Schema::connection方法的具体用法?PHP Schema::connection怎么用?PHP Schema::connection使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Support\Facades\Schema
的用法示例。
在下文中一共展示了Schema::connection方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('ff-actions-calc')->drop('terminals');
Schema::connection('ff-actions-calc')->drop('events');
Schema::connection('ff-actions-calc')->drop('rules');
Schema::connection('ff-actions-calc')->drop('signals');
}
示例2: testArtisanRefresh
public function testArtisanRefresh()
{
$this->executeDefaultMigration()->call('migrate:refresh', array('--type' => $this->testType));
$this->resetLaravelPaths();
$this->assertTrue(Schema::connection('artisantest_' . $this->testType)->hasTable('test_tbl'));
$entry = $this->app['db']->connection('artisantest_' . $this->testType)->table('test_tbl')->where('id', 1)->first();
$this->assertEquals($this->testType, $entry->test_val);
}
示例3: createSchema
/**
* Create Table Schema.
*
* @param \Closure $blueprint
*/
protected function createSchema(Closure $blueprint)
{
if (!$this->hasConnection()) {
Schema::create($this->getTableName(), $blueprint);
return;
}
Schema::connection($this->connection)->create($this->getTableName(), $blueprint);
}
示例4: up
/**
* Run the migrations.
*/
public function up()
{
Schema::connection($this->connection)->create($this->table, function (Blueprint $table) {
$table->string('email')->index();
$table->string('token')->index();
$table->timestamp('created_at')->nullable();
});
}
开发者ID:ARCANEDEV,项目名称:LaravelAuth,代码行数:11,代码来源:2015_01_01_000008_create_auth_password_resets_table.php
示例5: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('ff-qiwi-gate')->table('merchants_bills', function (Blueprint $table) {
$table->dropColumn('lifetime');
});
Schema::connection('ff-qiwi-gate')->table('merchants_bills', function (Blueprint $table) {
$table->string('lifetime')->after('comment');
});
}
开发者ID:fintech-fab,项目名称:qiwi-gate,代码行数:14,代码来源:2014_04_30_213959_change_type_column_lifetime_to_timestampe.php
示例6: up
/**
* Run the migrations.
*/
public function up()
{
Schema::connection($this->connection)->create($this->table, function (Blueprint $table) {
$table->integer('permission_id')->unsigned();
$table->integer('role_id')->unsigned();
$table->timestamps();
$table->primary(['permission_id', 'role_id']);
});
}
开发者ID:bztrn,项目名称:LaravelAuth,代码行数:12,代码来源:2015_01_01_000006_create_auth_permission_role_pivot_table.php
示例7: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::connection('ff-qiwi-shop')->drop('orders_pay_return');
Schema::connection('ff-qiwi-shop')->table('orders', function (Blueprint $table) {
$table->string('statusReturn')->nullable()->after('status')->default(null);
});
Schema::connection('ff-qiwi-shop')->table('orders', function (Blueprint $table) {
$table->dropColumn('idLastReturn');
});
}
示例8: up
/**
* Run the migrations.
*/
public function up()
{
Schema::connection($this->connection)->create($this->table, function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('slug');
$table->string('description')->nullable();
$table->timestamps();
$table->unique('slug');
});
}
开发者ID:bztrn,项目名称:LaravelAuth,代码行数:14,代码来源:2015_01_01_000003_create_auth_permissions_groups_table.php
示例9: executeSchema
/**
* Check if we need to run the schema
* @return [type] [description]
*/
public static function executeSchema()
{
$schema = Schema::connection('mysql');
if (!$schema->hasTable('users')) {
Schema::connection('mysql')->create('users', function ($table) {
$table->increments('id');
$table->string('name');
$table->timestamps();
});
}
}
示例10: executeSchema
/**
* Check if we need to run the schema
* @return [type] [description]
*/
public static function executeSchema()
{
$schema = Schema::connection('mysql');
if (!$schema->hasTable('books')) {
Schema::connection('mysql')->create('books', function ($table) {
$table->string('title');
$table->string('author_id');
$table->timestamps();
});
}
}
示例11: up
/**
* Run the migrations.
*/
public function up()
{
if ($this->isThrottlable()) {
Schema::connection($this->connection)->create($this->table, function (Blueprint $table) {
$table->increments('id');
$table->integer('user_id')->unsigned()->nullable();
$table->string('type');
$table->string('ip')->nullable();
$table->timestamps();
});
}
}
示例12: emptyDatabase
/**
* Delete all database tables.
*/
private function emptyDatabase()
{
if (!$this->option('empty-database')) {
return;
}
$this->info("Truncating {$this->connection} database.");
$tableNames = Schema::connection($this->connection)->getConnection()->getDoctrineSchemaManager()->listTableNames();
DB::connection($this->connection)->statement($this->sql->setForeignKeyChecks(false));
foreach ($tableNames as $table) {
Schema::connection($this->connection)->drop($table);
}
DB::connection($this->connection)->statement($this->sql->setForeignKeyChecks(true));
}
示例13: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$data = $request->all();
$userFields = Schema::connection('mysql')->getColumnListing('users');
if (isset($data)) {
$user = User::find($data['id']);
foreach ($data as $key => $value) {
if (in_array($key, $userFields)) {
$user[$key] = $value;
}
}
$user->save();
}
return response()->json(array('success' => 'true'));
}
示例14: __construct
/**
* Create a new Local gateway instance.
*
* @return void
*/
public function __construct($connection = null)
{
if (null === $connection) {
$connection = config('billing.gateways.local');
}
$this->connection = $connection;
\Config::set('database.connections.billinglocal', Arr::get($connection, 'database'));
$path = Arr::get($connection, 'database.database');
if (!file_exists($path) && is_dir(dirname($path))) {
touch($path);
}
if (!Schema::connection('billinglocal')->hasTable('customers')) {
include_once 'Models/migration.php';
}
}
示例15: update
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param int $id
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
{
$data = $request->all();
$noteFields = Schema::connection('mysql')->getColumnListing('notes');
if (isset($data)) {
$note = Note::find($id);
if (in_array($data['name'], $noteFields)) {
if ($this->utilityService->isDateField($data['name'])) {
$data['value'] = $this->utilityService->parseToMysqlDate($data['value']);
}
$note[$data['name']] = $data['value'];
}
$note->save();
}
return response()->json(array('note' => $note->toArray()));
}