首页 » 网站推广 » lumenconfigphp技巧_lumen安装iseed碰着的问题

lumenconfigphp技巧_lumen安装iseed碰着的问题

访客 2024-11-17 0

扫一扫用手机浏览

文章目录 [+]

我们在这里利用 orangehill/iseed

安装命令:

lumenconfigphp技巧_lumen安装iseed碰着的问题

composer require orangehill/iseed

lumenconfigphp技巧_lumen安装iseed碰着的问题
(图片来自网络侵删)

安装完成之后测试下:

运行:php artisan iseed users 我这里利用了users表做测试

结果显示:

Command "iseed" is not defined.

办理方法,注册引入 Orangehill\Iseed 包。

我的在 bootstrap/app.php 文件中添加

$app->register(Orangehill\Iseed\IseedServiceProvider::class);

然后再运行

运行:php artisan iseed users

显示:

Call to undefined method Laravel\Lumen\Application::booting()

找到这个方法:

在vendor/orangehill/iseed/src/Orangehill/Iseed/IseedServiceProvider.php的register()方法中。
改动如下:public function register(){ $this->registerResources(); $this->app->singleton('iseed', function($app) { return new Iseed; }); // var_dump(method_exists ($this->app,'boot'));die; $this->app->boot(function() { // todo 将booting改成boot即可 $loader = \Illuminate\Foundation\AliasLoader::getInstance(); $loader->alias('Iseed', 'Orangehill\Iseed\Facades\Iseed'); });​ $this->app->singleton('command.iseed', function($app) { return new IseedCommand; });​ $this->commands('command.iseed');}

再运行命令

运行:php artisan iseed users

结果显示:

In IseedCommand.php line 163:

Class 'Config' not found

In IseedCommand.php line 96:

Class 'File' not found

办理办法:

将类精确引入即可。
我这里引入的两个类分别是。

use Illuminate\Support\Facades\Config;use Illuminate\Support\Facades\File;

末了再运行

php artisan iseed users

成功

显示:

php artisan iseed users​ File UsersTableSeeder.php already exist. Do you wish to override it? [yes|no] (yes/no) [no]: > yes​Created a seed file from table users​

结束

相关文章

介绍网页设计,如何打造吸引人的视觉体验

随着互联网的飞速发展,网页设计已经成为企业品牌形象展示的重要窗口。一个优秀的网页设计,不仅能够提升企业的形象,还能提高用户访问体验...

网站推广 2025-01-03 阅读0 评论0

介绍炫舞开挂,技术背后的伦理与法律困境

随着我国互联网的飞速发展,网络游戏已成为人们休闲娱乐的重要方式之一。炫舞作为一款热门的舞蹈类网络游戏,吸引了众多玩家。近年来,炫舞...

网站推广 2025-01-03 阅读0 评论0

介绍滔五笔,传承与创新并行的汉字输入法

随着科技的飞速发展,计算机已成为我们生活中不可或缺的工具。在众多汉字输入法中,滔五笔以其独特的优势和传承创新的精神,赢得了广大用户...

网站推广 2025-01-03 阅读0 评论0