Base table or view not found laravel - Running scheduler cron

504 Views Asked by At

while running php artisan eventnotification:mail in command, it throws below error
"SQLSTATE[42S02]: Base table or view not found: 1146 Table "

My appserviceprovider.php

public function boot() {
    $rolesList = $this->getRolesList();
    View::share("rolesListArr", $rolesList);
}

My cron job:

protected function schedule(Schedule $schedule)
{
    $schedule->command('eventnotification:mail')->everyMinute();

}

How can i fix the " [Illuminate\Database\QueryException] SQLSTATE[42S02]: Base table or view not found: 1146 Table "

1

There are 1 best solutions below

2
On

Check your migration file, maybe you are using Schema::table, like this:

Schema::table('table_name', function ($table)  {
    // ...
});

If you want to create a new table you must use Schema::create:

Schema::create('table_name', function ($table)  {
    // ...
});

See the Laravel migration documentation for more information.

If you are using Schema::create then please provide the contents of your migration file.