RioSant
RioSant

Reputation: 153

When I am calling any artisan command for my Laravel project, It is giving me one error all the time

When I am calling any artisan command for my Laravel project, It is giving me one error all the time.

enter image description here

When I called base URL is giving following error

D:\xampp\htdocs\beatsbajao\
Illuminate\Database\QueryException
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'l8.resources' doesn't exist (SQL: select * from `resources` limit 1)
http://localhost/beatsbajao/
Hide solutions
A table was not found
You might have forgotten to run your migrations. You can run your migrations using php artisan migrate.

Pressing the button below will try to run your migrations.

READ MORE
Database: Running Migrations docs

My resources migration looks like this

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateResourcesTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('resources', function (Blueprint $table) {
            $table->id();
            $table->text('logo_base64');
            $table->string('logo_data_uri');
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('resources');
    }
}

Upvotes: 0

Views: 219

Answers (2)

RioSant
RioSant

Reputation: 153

I got the problem solved, Replying to my own question if others can get help from it.

The problem was that I had created a Service Provider and in that service provide I was using a model like this

Resource::all();

When I commented that code and run artisan command, It worked like a charm. after executing command. I restored my code and proceeded further.

Upvotes: 0

Esa Kian
Esa Kian

Reputation: 281

There appear to be settings in your database that do not allow migrations to run. If you can delete the database and recreate it and run the migrations.

Upvotes: 1

Related Questions