laravel-5 - laravel 通过路由播种 db
问题描述
我想通过 web.php 运行播种器命令这是我的代码
Route::get('permission-seeder/{class}',function($class){ Artisan::call("db:seed --class=$class"); });
我收到此错误
Symfony \ Component \ Console \ Exception \ CommandNotFoundException The command "db:seed --class=PermissionSeeder" does not exist.
虽然这个播种机存在于目录中
谁能解决
解决方案
传递参数的方式错误,这是通过路由运行播种机的正确方法
Route::get('run-seeder/{class}',function($class){ Artisan::call("db:seed",array('--class'=>$class)); });
推荐阅读
- android - 如何使中风在按钮外开始 - android
- php - Laravel 8 显示集合的第 4、第 5 和第 6 个元素
- python - 为什么 discord.py 不让我编辑嵌入?
- c# - 我可以像读取 C# 中的文件一样读取 MemoryStream 吗?
- javascript - 从chart.js中解析的csv向每一列添加不同的点样式
- spring-boot - 如何设置 javax.net.ssl.sessionCacheSize
- indexing - 修复解析错误后,我应该等待谷歌网站管理员多久重新开始抓取和索引?
- java - 在 Android Studio 中,因为 Environment.getExternalStorageDirectory() 可能很快会被删除 如何在根目录中创建文件夹
- flutter - 使用 websocket 连接到 ESP8266
- spring-boot - 如何覆盖 Spring Cloud Stream 的 Jackson ObjectMapper 配置?