title: Base table or view not found laravel pivot table
body: <p>Posts table looks like.</p>
  
  <pre><code>Schema::create('posts', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;integer('user_id')-&gt;unsigned();
          $table-&gt;string('title');
          $table-&gt;string('slug')-&gt;unique();
          $table-&gt;string('image')-&gt;default('default.png');
          $table-&gt;text('body');
          $table-&gt;boolean('is_approved')-&gt;default(false);
          $table-&gt;boolean('status')-&gt;default(false);
          $table-&gt;integer('view_count')-&gt;default(0);
          $table-&gt;foreign('user_id')
              -&gt;references('id')-&gt;on('users')
              -&gt;onDelete('cascade')-&gt;unsigned()-&gt;index();
          $table-&gt;timestamps();
      });
  </code></pre>
  
  <p><strong>User table.</strong></p>
  
  <pre><code>Schema::create('users', function (Blueprint $table) {
          $table-&gt;increments('id');
          $table-&gt;integer('role_id')-&gt;default(2);
          $table-&gt;string('name');
          $table-&gt;string('username')-&gt;unique();
          $table-&gt;string('email')-&gt;unique();
          $table-&gt;string('image')-&gt;default('default.png');
          $table-&gt;timestamp('email_verified_at')-&gt;nullable();
          $table-&gt;string('password');
          $table-&gt;text('about')-&gt;nullable();
          $table-&gt;rememberToken();
          $table-&gt;timestamps();
      });
  </code></pre>
  
  <p>When run php artisan:migrate got the error.</p>
  
  <p>I can't find it.</p>
  
  <p>There is my post_users table.</p>
  
  <pre><code> Schema::table('post_users', function (Blueprint $table) {
          $table-&gt;integer('post_id')-&gt;unsigned();
          $table-&gt;integer('user_id');
          $table-&gt;foreign('post_id')
              -&gt;references('id')-&gt;on('posts')
              -&gt;onDelete('cascade')-&gt;unsigned()-&gt;index();
      });
  </code></pre>
  
  <p><a href="https://i.stack.imgur.com/Lkj2X.png" rel="nofollow noreferrer">enter image description here</a></p>