为什么我的artisan命令不能随便使用?

为什么我的php artisan命令,运行生成控制器,生成model都没问题,但是用db:seed却出现问题,这是什么原因?windows电脑,显示There are no commands defined in the "db:" namespace.

你的報錯有點奇怪:

There are no commands defined in the "db:" namespace.

正常來講找不到 namespace 應該是這樣

There are no commands defined in the "db" namespace.

你卻多了一個冒號,感覺是打成了 db::seed

剛剛故意打錯的指令來試的結果。

JellyBool

你在命令行敲:

php artisan

出来的命令行你确定有 db:seed ? 你使用的是 laravel 的什么版本?还是你用的lumen

cnsecer 回复 JellyBool

我用的laravel5.3.18

cnsecer 回复 JellyBool

我确定有db:seed,专门看了看,很明显有这个命令,但是我确实不清楚为什么可以生成控制器,却执行不了db:seed 命令

JellyBool 回复 cnsecer

嗯哼,我刚刚测试了一下,我这在 5.3.18 这个版本是正常使用的。

你具体修改过什么代码么?

cnsecer 回复 JellyBool

没有啊!我是直接composer安装的,lavaral的自带代码没有改过,不过,还是谢谢层主

cnsecer 回复 JellyBool

还有一个问题,就是生成控制器的时候,我生成的控制器不带那些自带方法,比如create,index这种,我估计跟这个问题可能原因近似。

JellyBool 回复 cnsecer
php artisan make:controller UserController --resource
cnsecer 回复 JellyBool

我少打了 --resource,多谢站长!还有就是那个就是多打了一个:。

cnsecer

我用的laravel5.3

cnsecer

5.3.18

Tomoe

你的報錯有點奇怪:

There are no commands defined in the "db:" namespace.

正常來講找不到 namespace 應該是這樣

There are no commands defined in the "db" namespace.

你卻多了一個冒號,感覺是打成了 db::seed

剛剛故意打錯的指令來試的結果。

cnsecer 回复 Tomoe

貌似就是多打了冒号,我去= =,,,

JellyBool 回复 Tomoe

厉害啊,这个实在是佩服