Php 未找到基表或视图LAVEL透视表

Php 未找到基表或视图LAVEL透视表,php,mysql,laravel,Php,Mysql,Laravel,Posts表看起来像 Schema::create('posts', function (Blueprint $table) { $table->increments('id'); $table->integer('user_id')->unsigned(); $table->string('title'); $table->string('slug')->unique(); $t

Posts表看起来像

Schema::create('posts', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('user_id')->unsigned();
        $table->string('title');
        $table->string('slug')->unique();
        $table->string('image')->default('default.png');
        $table->text('body');
        $table->boolean('is_approved')->default(false);
        $table->boolean('status')->default(false);
        $table->integer('view_count')->default(0);
        $table->foreign('user_id')
            ->references('id')->on('users')
            ->onDelete('cascade')->unsigned()->index();
        $table->timestamps();
    });
用户表。

Schema::create('users', function (Blueprint $table) {
        $table->increments('id');
        $table->integer('role_id')->default(2);
        $table->string('name');
        $table->string('username')->unique();
        $table->string('email')->unique();
        $table->string('image')->default('default.png');
        $table->timestamp('email_verified_at')->nullable();
        $table->string('password');
        $table->text('about')->nullable();
        $table->rememberToken();
        $table->timestamps();
    });
运行php artisan:migrate时出错

我找不到它

这是我的post_用户表

 Schema::table('post_users', function (Blueprint $table) {
        $table->integer('post_id')->unsigned();
        $table->integer('user_id');
        $table->foreign('post_id')
            ->references('id')->on('posts')
            ->onDelete('cascade')->unsigned()->index();
    });

姿势中
模型定义表名

class PostUsers extends Model {
    public $table = "post_users";
更新:

不应该

Schema::table('post_users', function (Blueprint $table) {
    $table->integer('post_id')->unsigned();
    $table->integer('user_id');
    $table->foreign('post_id')
        ->references('id')->on('posts')
        ->onDelete('cascade')->unsigned()->index();
});


如果要创建新表,必须使用
Schema::create

$table->increments('id');在post_users表中添加此代码添加此,仍然相同的错误显示迁移文件位置数据库->迁移它不是模型。我想创建一个post和user的透视表
Schema::create('post_users', function (Blueprint $table) {
    $table->integer('post_id')->unsigned();
    $table->integer('user_id');
    $table->foreign('post_id')
        ->references('id')->on('posts')
        ->onDelete('cascade')->unsigned()->index();
});