本文整理汇总了PHP中Illuminate\Database\Migrations\Migrator::resolve方法的典型用法代码示例。如果您正苦于以下问题:PHP Migrator::resolve方法的具体用法?PHP Migrator::resolve怎么用?PHP Migrator::resolve使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Migrations\Migrator
的用法示例。
在下文中一共展示了Migrator::resolve方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: resolve
public function resolve($file)
{
/* @var $class \Consolet\Migrator\Migration */
$class = parent::resolve($file);
$class::setSchemaOnce($this->resolveConnection(null)->getSchemaBuilder());
return $class;
}
示例2: resolve
/**
* Resolve a migration instance from a file.
*
* @param string $file
*
* @return Migration
*/
public function resolve($file)
{
$this->requireOnce($file);
if (!str_is('*.*.*', $file)) {
return parent::resolve($file);
}
return app($this->dispatch(new TransformMigrationNameToClass($this->removeDatePrefix($file))));
}
示例3: resetMigrations
/**
* Reset the migrations for the extension with an
* optional customized path.
*
* @param string $path
* @return void
*/
protected function resetMigrations($path = null)
{
if (!isset(static::$migrator)) {
return;
}
$path = $path ?: $this->getMigrationsPath();
$files = static::$migrator->getMigrationFiles($path);
$repository = static::$migrator->getRepository();
// Get an array of migration names which will be
// reset
$migrations = array_intersect(array_reverse($repository->getRan()), $files);
// Loop through the migrations we have to rollback
foreach ($migrations as $migration) {
// Let the migrator resolve the migration instance
$instance = static::$migrator->resolve($migration);
// And we'll call the down method on the migration
$instance->down();
// Now we need to manipulate what the migrator does to
// delete a migration.
$migrationClass = new \StdClass();
$migrationClass->migration = $migration;
$repository->delete($migrationClass);
}
}