mirror of
https://gitee.com/ulthon/ulthon_admin.git
synced 2026-07-07 10:32:48 +08:00
修复seeder错误;删除第三方的think迁移工具,在extend中重新实现;
This commit is contained in:
40
extend/think/migration/helper.php
Normal file
40
extend/think/migration/helper.php
Normal file
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
use think\migration\Factory;
|
||||
use think\migration\FactoryBuilder;
|
||||
|
||||
if (!function_exists('factory')) {
|
||||
/**
|
||||
* Create a model factory builder for a given class, name, and amount.
|
||||
*
|
||||
* @param mixed class|class,name|class,amount|class,name,amount
|
||||
* @return FactoryBuilder
|
||||
*/
|
||||
function factory()
|
||||
{
|
||||
/** @var Factory $factory */
|
||||
$factory = app(Factory::class);
|
||||
|
||||
$arguments = func_get_args();
|
||||
|
||||
if (isset($arguments[1]) && is_string($arguments[1])) {
|
||||
return $factory->of($arguments[0], $arguments[1])->times($arguments[2] ?? null);
|
||||
} elseif (isset($arguments[1])) {
|
||||
return $factory->of($arguments[0])->times($arguments[1]);
|
||||
}
|
||||
|
||||
return $factory->of($arguments[0]);
|
||||
}
|
||||
}
|
||||
|
||||
if (!function_exists('database_path')) {
|
||||
/**
|
||||
* 获取数据迁移脚本地址
|
||||
* @param string $path
|
||||
* @return string
|
||||
*/
|
||||
function database_path($path = '')
|
||||
{
|
||||
return app()->getRootPath() . 'database' . DIRECTORY_SEPARATOR . $path;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user