Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Tinker Not Working After Upgrading From 5.3 To 5.4

Tags:

laravel

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 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.

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

And here is my 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:

 [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.

like image 996
Surya W Avatar asked Jan 27 '17 06:01

Surya W


People also ask

Where is Tinker in Laravel?

The command is built into every Laravel application and you can use it to run code within the context of your application. Let's explore what this means. Tinker is a REPL (read-eval-print loop) on top of PsySH. It takes your command line input, evaluates it and prints the output to the console.

What the purpose of ls command in laravel tinker?

The ls command can be used to learn more about the $user variable; this is because the $user variable is holding a reference to an instance of the App\User class.


2 Answers

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.

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

like image 131
sisve Avatar answered Oct 02 '22 15:10

sisve


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

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

then in console, make a

composer dump-autoload
like image 35
Oscar Romero Avatar answered Oct 02 '22 15:10

Oscar Romero