首页 > 解决方案 > 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.

虽然这个播种机存在于目录中

谁能解决

标签: laravel-5

解决方案


传递参数的方式错误,这是通过路由运行播种机的正确方法

Route::get('run-seeder/{class}',function($class){ Artisan::call("db:seed",array('--class'=>$class)); });


推荐阅读