我尝试使用 Lumen 5.4 安装,但我不断收到此错误
There are no commands defined in the "vendor" namespace.
。
我已采取的步骤
1)将
"zizaco/entrust": "5.2.x-dev"
添加到composer.json
2) 也添加
$app->register(Zizaco\Entrust\EntrustServiceProvider::class);
app.php
3)
composer update
4)创建这个helpers.php 文件
if ( ! function_exists('config_path'))
{
/**
* Get the configuration path.
*
* @param string $path
* @return string
*/
function config_path($path = '')
{
return app()->basePath() . '/config' . ($path ? '/' . $path : $path);
}
}
5)将其添加到composer.json
"autoload": {
"files": [
"app/helpers.php"
]
}
6) 在EntrustServiceProvider.php
中注释掉
//$this->bladeDirectives();
7)将发布功能更改为
$this->publishes([
- __DIR__.'/../config/config.php' => config_path('entrust.php'),
+ __DIR__.'/../config/config.php' => app()->basePath() . '/config/entrust.php',
]);
8)
composer dump-autoload -o
9)
php artisan vendor:publish
错误
Fatal error: Call to undefined function Zizaco\Entrust\config_path() in /Users/API/vendor/zizaco/entrust/src/Entrust/EntrustServiceProvider.php on line 31
[Symfony\Component\Debug\Exception\FatalErrorException]
Call to undefined function Zizaco\Entrust\config_path()
通过安装此软件包并安装 entrust 修复了错误
查看您的配置 pp.php。可能是您没有在 'providers' 键处注册 Illuminate\Foundation\Providers\ConsoleSupportServiceProvider::class 。