How we solve ‘There are no commands defined in the “cashier” namespace’ in Laravel

Share Me
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  
  •  

Here now in this post we will know How we solve ‘There are no commands defined in the “cashier” namespace’ in Laravel. When i was start to learn “Laravel Cashier” and there i was the following step by step of form laravel official document, but here i will the run bellow command :

php artisan cashier:table users

So at that time i was found the following error on my terminal:

[Symfony\Component\Console\Exception\CommandNotFoundException]    
There are no commands defined in the "cashier" namespace.

Then I was try to solve this error, i was also clear all cache and then add the service provider, it means i try totally and i can’t found the solution for this error, but we can also the add migration as like on this way if we want it is a same like we can run the bellow command. so at first need run command for create migration:

php artisan make:migration add_cashier_table_fields

ok good, now need to put bellow content on following file :

Migration:
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class AddBillTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::table('users', function ($table) {
            $table->string('stripe_id')->nullable();
            $table->string('card_brand')->nullable();
            $table->string('card_last_four')->nullable();
            $table->timestamp('trial_ends_at')->nullable();
        });
        Schema::create('subscriptions', function ($table) {
            $table->increments('id');
            $table->integer('user_id');
            $table->string('name');
            $table->string('stripe_id');
            $table->string('stripe_plan');
            $table->integer('quantity');
            $table->timestamp('trial_ends_at')->nullable();
            $table->timestamp('ends_at')->nullable();
            $table->timestamps();
        });
    }
    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        

    }
}

Read Also : How to convert Object into Array in PHP?

Thanks for read. I hope it help you. For more you can follow us on facebook.

About code chef

My name is Shahriar sagor. I'm a developer. I live in Bangladesh and I love to write tutorials and tips that will help to other Developer's. I am a big fan of PHP, Javascript, JQuery, Laravel, Codeigniter, VueJS, AngularJS and Bootstrap from the early stage.

View all posts by code chef →