Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

K1rel's avatar
Level 1

Weird error with following the 30 days of laravel course

I follow step by step when i came across this error in the episode 29 of 30 days to learn laravel course (the migration worked for the employers and i have the table in my database) :

FAILED Tests\Unit\JobTest > it it belongs to an employer QueryException SQLSTATE[42P01]: Undefined table: 7 ERROR: relation "employer" does not exist LINE 1: insert into "employer" ("name", "logo", "user_id", "updated_... ^ (Connection: pgsql, SQL: insert into "employer" ("name", "logo", "user_id", "updated_at", "created_at") values (Isom Jenkins,linkforpic/640x480.png/009933?text=qui, 1, 2024-07-20 17:18:16, 2024-07-20 17:18:16))

at vendor\laravel\framework\src\Illuminate\Database\Connection.php:571 567▕ $this->bindValues($statement, $this->prepareBindings($bindings)); 568▕ 569▕ $this->recordsHaveBeenModified(); 570▕ ➜ 571▕ return $statement->execute(); 572▕ }); 573▕ } 574▕ 575▕ /**

1 vendor\laravel\framework\src\Illuminate\Database\Connection.php:571 2 vendor\laravel\framework\src\Illuminate\Database\Connection.php:800

Tests: 1 failed, 2 passed (2 assertions) Duration: 0.80s

the only difference that i have with the videos is that i use postgresql and this is how my jobs migration is created:

public function up(): void { Schema::create('jobs', function (Blueprint $table) {

        $table->id();
       
        $table->unsignedBigInteger('employer_id');
        $table->foreign('employer_id')->references('id')->on('employers')->onDelete('cascade');
        
        $table->string('title');
        $table->string('salary');
        $table->string('location');
        $table->string('schedule')->default('Full Time');
        $table->string('url');
        $table->boolean('featured')->default(false);
        $table->timestamps();
    });
}
0 likes
1 reply
K1rel's avatar
Level 1

btw i get this when i run the php artisan test command with the exact copy of the JobTest.php from the course

Please or to participate in this conversation.