简体   繁体   English

当我为我的 Laravel 项目调用任何工匠命令时,它一直给我一个错误

[英]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.当我为我的 Laravel 项目调用任何 artisan 命令时,它一直给我一个错误。

在此处输入图片说明

When I called base URL is giving following error当我调用基本 URL 时出现以下错误

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');
    }
}

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.如果您可以删除数据库并重新创建它并运行迁移。

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.当我评论该代码并运行 artisan 命令时,它就像一个魅力。 after executing command.执行命令后。 I restored my code and proceeded further.我恢复了我的代码并继续进行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM