Jack Halik
Jack Halik

Reputation: 18

Do not understand why I am getting this Laravel Illuminate Error

This is the error:

[Illuminate\Database\QueryException]
SQLSTATE[42S02]: Base table or view not found: 1146 Table 'desk.messages' doesn't exist 
(SQL: insert into `messages` (`id`, `users_id`, `reps_id`, `comment`, `updated_at`, `created_at`)
values 
(1, 1, 1, testing, 2014-09-0 5 14:07:38, 2014-09-05 14:07:38))

I have the table protected in the method:

 /**
 * Connection name
 * @var string
 */
protected $table = 'messages';

And this is my Seeder:

 use Desk\Records\MessageRecord;

 class MessageSeeder extends Seeder {
/**
 * Run the database seeds.
 *
 * @return void
 */
public function run()
{
    Eloquent::unguard();

    $message = [
        'testUser' => [
            'id' => '1',
            'users_id' => '1',
            'reps_id' => '1',
            'comment' => 'testing',
        ]
    ];

    foreach( $message as $message )
    {
        MessageRecord::create($message);
    }

}

}

Upvotes: 0

Views: 99

Answers (2)

Antonio Carlos Ribeiro
Antonio Carlos Ribeiro

Reputation: 87719

It's tellin you that your database desks does not contain a table named messages.

Create the table using Laravel migrations or manually.

Upvotes: 1

clone1018
clone1018

Reputation: 1267

You need to create the table first, you can do that via Migrations.

Upvotes: 1

Related Questions