Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command "tinker" is not defined. #13

Closed
PaoloFalomo opened this issue May 29, 2017 · 10 comments
Closed

Command "tinker" is not defined. #13

PaoloFalomo opened this issue May 29, 2017 · 10 comments

Comments

@PaoloFalomo
Copy link

Using Laravel Framework 5.4.23

and

name     : laravel/tinker
descrip. : Powerful REPL for the Laravel framework.
keywords : REPL, Tinker, laravel, psysh
versions : * v1.0.0
type     : library
license  : MIT License (MIT) (OSI approved) https://spdx.org/licenses/MIT.html#licenseText
source   : [git] https://github.com/laravel/tinker.git 3d5b675b55b24ccbf86395964042dbe061d5a965
dist     : [zip] https://api.github.com/repos/laravel/tinker/zipball/3d5b675b55b24ccbf86395964042dbe061d5a965 3d5b675b55b24ccbf86395964042dbe061d5a965
names    : laravel/tinker

autoload
psr-4
Laravel\Tinker\ => src/

requires
illuminate/console ~5.1
illuminate/contracts ~5.1
illuminate/support ~5.1
php >=5.5.9
psy/psysh 0.7.*|0.8.*
symfony/var-dumper ~3.0

requires (dev)
phpunit/phpunit ~4.0|~5.0

suggests
illuminate/database The Illuminate Database package (~5.1).

when i do php artisan tinker as described on Repo's README.md file i got this error:

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

i tried this on an empty project from scratch and tinker is working - not on my current project

@PaoloFalomo
Copy link
Author

Tell me if more informations are needed

@GrahamCampbell
Copy link
Member

Are you using Lumen? Have you registered the service provider?

@PaoloFalomo
Copy link
Author

I just fixed this by adding

protected $commands = [
        TinkerCommand::class
    ];

in my app/Console/Kernel.php file.

Note Remember even to add the use Laravel\Tinker\Console\TinkerCommand;

//app/Console/Kernel.php file
...
use Laravel\Tinker\Console\TinkerCommand;
class Kernel extends ConsoleKernel{
...

@GrahamCampbell
Copy link
Member

GrahamCampbell commented May 29, 2017

That's not the correct fix. Please register the service provider:

$app->register(Laravel\Tinker\TinkerServiceProvider::class);

@GrahamCampbell
Copy link
Member

Otherwise tinker will not work correctly.

@PaoloFalomo
Copy link
Author

@GrahamCampbell yep! i di registered the service provider but it didn't worked.

@PaoloFalomo
Copy link
Author

@GrahamCampbell

        /*
         * Application Service Providers...
         */

        App\Providers\AppServiceProvider::class,
        App\Providers\AuthServiceProvider::class,
        App\Providers\EventServiceProvider::class,
        App\Providers\RouteServiceProvider::class,
        App\Providers\BroadcastServiceProvider::class,
        Thomaswelton\LaravelGravatar\LaravelGravatarServiceProvider::class,
        Conner\Tagging\Providers\TaggingServiceProvider::class,
        Collective\Html\HtmlServiceProvider::class,
        Watson\BootstrapForm\BootstrapFormServiceProvider::class,

        Barryvdh\LaravelIdeHelper\IdeHelperServiceProvider::class,
        Laravel\Tinker\TinkerServiceProvider::class,

@GrahamCampbell
Copy link
Member

Did you run php artisan config:cache?

@PaoloFalomo
Copy link
Author

php artisan config:cache solved the problem!! This should be added on readme.md file - i lost too much time for this :(

thank you @GrahamCampbell !!

@PaoloFalomo
Copy link
Author

#14 made a pull request for readme.md change

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants