Did you also make sure the migration table was empty as well? I have ran into this issue before where if the migrations table still had data I had this error.
SQLSTATE[42S02]: Base table or view not found: 1146 Table
I have rolled back all my migrations so there is nothing in my table. When I try to do anything with php artisan (even just php artisan tinker) I am getting the error
In Connection.php line 664:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'highcanary.categories' doesn't exist (SQL: select * from `categories`)
In Connection.php line 326:
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'highcanary.categories' doesn't exist
I tried connecting to a new database but still getting the error. I do have the migration file for category
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateCategoriesTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('categories', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('slug');
$table->string('name');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('categories');
}
}
I have even tried to do adjust the categories.php model to name the table
<?php
namespace App;
use Illuminate\Database\Eloquent\Model;
class Category extends Model
{
public $table = "categories";
protected $guarded = [];
protected $with = ['roundups'];
public function getRouteKeyName()
{
return 'slug';
}
public function roundups()
{
return $this->hasMany(Roundup::class);
}
}
I am stuck and don't know how to move forward. I tried deleting all my routes and I am still getting the error. Thanks so much for any help!
Oh man I finally figured it out. I had added code to my AppServiceProvider public boot function that was calling on that table to show in each view!
Please or to participate in this conversation.