我有这样的控制器
public function store(Request $request) { Artisan::call("PHP artisan infyom:scaffold {$request['name']} --fieldsFile=public/Product.json"); }
告诉我错误
There are no commands defined in the “PHP artisan infyom” namespace.
当我在CMD中运行此命令时,它可以正常工作
您需要删除PHP artisan部件并将参数放入数组中以使其工作:
原文链接:https://www.f2er.com/laravel/135844.htmlpublic function store(Request $request) { Artisan::call("infyom:scaffold",['name' => $request['name'],'--fieldsFile' => 'public/Product.json']); }
https://laravel.com/docs/5.2/artisan#calling-commands-via-code