jet

In Connection.php line 452: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'submodule.submodules' doesn't exist

Posted 4 months ago by jet

when I want to create fake data them I have the error above

I need help

<?php

use Illuminate\Database\Seeder;

class SubmoduleTableSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
            factory(App\Submodule::class, 30)->create();   
    }

}
<?php

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

class CreateSubmoduleTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('submodule', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name');
            $table->string('content');
            $table->string('order');
            $table->string('status');
            $table->string('content_type');
            $table->string('cmodule_id');
            $table->string('user_id');
            $table->timestamps();
        });
    }

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

use Faker\Generator as Faker;

/*
|--------------------------------------------------------------------------
| Model Factories
|--------------------------------------------------------------------------
|
| This directory should contain each of the model factory definitions for
| your application. Factories provide a convenient way to generate new
| model instances for testing / seeding your application's database.
|
*/

$factory->define(App\Submodule::class, function (Faker $faker) {
    return [
                'name' => $faker->text(60),
                'content' => $faker->text(100),
                'status' => $faker->text(60),
                'order' => $faker->text(60),
                'content_type' => $faker->text(60),
                'cmodule_id' => $faker->text(60),
                'user_id' => $faker->text(60),
    ];
});

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up

Channels

Reply to

Use Markdown with GitHub-flavored code blocks.