本文整理汇总了PHP中Illuminate\Database\ConnectionResolverInterface::setDefaultConnection方法的典型用法代码示例。如果您正苦于以下问题:PHP ConnectionResolverInterface::setDefaultConnection方法的具体用法?PHP ConnectionResolverInterface::setDefaultConnection怎么用?PHP ConnectionResolverInterface::setDefaultConnection使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\ConnectionResolverInterface
的用法示例。
在下文中一共展示了ConnectionResolverInterface::setDefaultConnection方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
if (!$this->confirmToProceed()) {
return;
}
$this->resolver->setDefaultConnection($this->getDatabase());
$this->getSeeder()->run();
}
示例2: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
if (!$this->confirmToProceed()) {
return;
}
$this->resolver->setDefaultConnection($this->getDatabase());
Model::unguarded(function () {
$this->getSeeder()->__invoke();
});
}
示例3: handle
/**
* @return mixed
*/
public function handle()
{
// TODO: Implement handle() method.
if (!$this->confirmToProceed()) {
return;
}
$this->resolver->setDefaultConnection($this->getDatabase());
Model::unguarded(function () {
$this->getSeeder()->run();
});
}
示例4: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$tenants = $this->manager->getRepository()->getTenants();
$seeder = $this->getSeeder();
foreach ($tenants as $tenant) {
$this->manager->bootstrapConnectionByTenantName($tenant->tenant_name);
$this->resolver->setDefaultConnection($tenant->tenant_name);
$this->manager->assumeTenant($tenant->id, true);
$seeder->run();
$this->output->writeln('<info>Seeded tenant ' . $tenant->tenant_name . '</info>');
$this->manager->restoreTenant();
}
}
示例5: setConnection
/**
* Set the default connection name.
*
* @param string $name
* @return void
*/
public function setConnection($name)
{
if (!is_null($name)) {
$this->resolver->setDefaultConnection($name);
}
$this->repository->setSource($name);
$this->connection = $name;
}
示例6: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$this->resolver->setDefaultConnection($this->getDatabase());
$this->getSeeder()->run();
}