In Connection.php line 664:
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint (SQL: alter table `point_deliveries` add constraint `point_d
eliveries_city_ref_foreign` foreign key (`city_ref`) references `cities` (`ref`))
In Connection.php line 458:
SQLSTATE[HY000]: General error: 1215 Cannot add foreign key constraint
Я связываю таблицы так ...
//parent
Schema::create('cities', function(Blueprint $table)
{
$table->increments('id');
$table->string('title')->nullable();
$table->string('ref');
$table->integer('country_id')->index()->unsigned()->nullable();
$table->foreign('country_id')->references('id')->on('countries');
});
//child
Schema::create('point_deliveries', function (Blueprint $table)
{
$table->increments('id');
$table->string('title')->nullable();
$table->string('ref')->nullable();
$table->string('city_ref');
$table->foreign('city_ref')->references('ref')->on('cities');
});
как их связать?Нет проблем с полем integer.