Laravel Tinker 从 5.3 升级到 5.4 后不工作

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/41888059/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 15:12:43  来源:igfitidea点击:

Laravel Tinker Not Working After Upgrading From 5.3 To 5.4

laravel

提问by Surya W

I recently upgrade Laravel 5.3 to Laravel 5.4. I had read the upgrade guide provided by the laravel, and everything looks good. Until I try to run the Laravel Tinker and it's not working. I already followed the upgrade guide specifically for Laravel Tinker part.

我最近将 Laravel 5.3 升级到 Laravel 5.4。我已经阅读了 laravel 提供的升级指南,一切看起来都不错。直到我尝试运行 Laravel Tinker 并且它不起作用。我已经遵循了 Laravel Tinker 部分的升级指南。

Laravel Tinker

In order to continue using the tinker Artisan command, you should also install the laravel/tinker package:

composer require laravel/tinker

Once the package has been installed, you should add Laravel\Tinker\TinkerServiceProvider::class to the providers array in your config/app.php configuration file.

Laravel 修补匠

为了继续使用 tinker Artisan 命令,您还应该安装 laravel/tinker 包:

作曲家需要 Laravel/tinker

安装包后,您应该将 Laravel\Tinker\TinkerServiceProvider::class 添加到 config/app.php 配置文件中的 providers 数组中。

Source: https://laravel.com/docs/5.4/upgrade

来源:https: //laravel.com/docs/5.4/upgrade

And here is my config/app.php :

这是我的 config/app.php :

'providers' => [

        /*
         * Laravel Framework Service Providers...
         */
        Laravel\Tinker\TinkerServiceProvider::class,

But then, when I ran the command "php artisan tinker", it says this:

但是,当我运行命令“php artisan tinker”时,它说:

 [Symfony\Component\Console\Exception\CommandNotFoundException]
  Command "tinker" is not defined.

Has anybody experienced this before?

有没有人经历过这种情况?

Note: other artisan command works perfectly and I can see my site just fine.

注意:其他 artisan 命令工作正常,我可以很好地看到我的网站。

回答by sisve

Laravel Tinker

In order to continue using the tinker Artisan command, you should also install the laravel/tinker package:

composer require laravel/tinker

Once the package has been installed, you should add Laravel\Tinker\TinkerServiceProvider::classto the providers array in your config/app.php configuration file.

Laravel 修补匠

为了继续使用 tinker Artisan 命令,您还应该安装 laravel/tinker 包:

composer require laravel/tinker

安装包后,您应该将其添加Laravel\Tinker\TinkerServiceProvider::class到 config/app.php 配置文件中的 providers 数组中。

Source: https://laravel.com/docs/5.4/upgrade

来源:https: //laravel.com/docs/5.4/upgrade

回答by Oscar Romero

Edit your app/Console/Kernel.php, then modify the $commandsproperty with this:

编辑您的app/Console/Kernel.php,然后使用以下内容修改$commands属性:

protected $commands = [
    //
    \Laravel\Tinker\Console\TinkerCommand::class,
];

then in console, make a

然后在控制台中,做一个

composer dump-autoload