Ok guys here is the Code for my tables, i hope anyone can help me:
Schema::create('departments', function (Blueprint $table) {
$table->increments('id');
$table->nullableTimestamps();
$table->string('comment')->nullable();
$table->string('name');
$table->timestamp('valid_start')->useCurrent();
$table->timestamp('valid_end')->nullable();
});
Schema::create('contacts', function (Blueprint $table) {
$table->increments('id');
$table->string('first_name');
$table->string('last_name');
$table->string('uid');
$table->string('comment');
$table->timestamp('valid_start')->useCurrent();
$table->timestamp('valid_end')->nullable();
$table->timestamps();
});
Schema::create('contact_types', function (Blueprint $table) {
$table->increments('id');
$table->string('name');
$table->string('comment');
$table->timestamp('valid_start')->useCurrent();
$table->timestamp('valid_end')->nullable();
$table->timestamps();
});
Schema::create('contact_contact_type_department', function (Blueprint $table) {
$table->increments('id');
$table->integer('contact_id')->unsigned();
$table->integer('department_id')->unsigned();
$table->integer('contact_role_id')->unsigned();
$table->string('comment');
$table->timestamp('valid_start')->useCurrent();
$table->timestamp('valid_end')->nullable();
$table->timestamps();
$table->foreign('contact_id')->references('id')->on('contacts');
$table->foreign('department_id')->references('id')->on('departments');
$table->foreign('contact_type_id')->references('id')->on('contact_types');
});