【发布时间】:2020-05-23 04:12:55
【问题描述】:
我在 Laravel 中有错误
当我们 $ php artisan db:seed 在 git
错误是:
Illuminate\Database\QueryException:SQLSTATE[42S02]:未找到基表或视图:1146 表 'noor_app.noors' 没有 t存在(SQL:插入
noors(title,description,completed,updated_at,created_at)值(Voluptates fac ilis velit repellat., Iure facere dolore ea earum。 Temporibus nesciunt minima eos., 0, 2020-02-07 02:11:12, 2020-02-07 02: 11:12))
mysql 中的信息
我的数据库名为:noor_app
我的桌子叫:
failed_jobs-migrations-noor-password_resets-users
工厂文件是:
noorFactory.php
用户工厂.php
这是 noorFactory.php
<?php
use Illuminate\Database\Seeder;
class noorSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\noor::class , 10)->create();
}
}
迁移文件
这是 2020_02_06_000033_create_noor_table.php
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateNoorTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('noor', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('title');
$table->text('description');
$table->boolean('completed');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('noor');
}
}
速度文件
这是 noorSpeeder.php
<?php
use Illuminate\Database\Seeder;
class noorSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
factory(App\noor::class , 10)->create();
}
}
速度文件
这是 DatabaseSpeeder.php
<?php
use Illuminate\Database\Seeder;
class DatabaseSeeder extends Seeder
{
/**
* Seed the application's database.
*
* @return void
*/
public function run()
{
$this->call(noorSeeder::class);
}
}
提供者文件
这是 AppServiceProvider.php
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
class AppServiceProvider extends ServiceProvider
{
/**
* Register any application services.
*
* @return void
*/
public function register()
{
//
}
/**
* Bootstrap any application services.
*
* @return void
*/
public function boot()
{
//
}
}
提供者文件
这是 noor.php
namespace App;
use Illuminate\Database\Eloquent\Model;
class noor extends Model
{
//
}
如何修复此错误以制作虚假数据库
谢谢
【问题讨论】:
-
还显示‘noor’模型里面有什么