Я пытаюсь добавить фотографию в мою рекламу скутера. но когда я пытаюсь мигрировать, я все время получаю эту ошибку:
Illuminate\Database\QueryException : SQLSTATE[42000]: Syntax error or access violation: 1072 Key column 'photo_id' doesn't exist in table (SQL: alter table `scooter` add constraint `scooter_photo_id_foreign` foreign key (`photo_id`) references `photo` (`id`))
я не понимаю, что делаю неправильно.
миграция скутера Класс CreateScooterTable extends Migration {
public function up()
{
Schema::create('scooter', function (Blueprint $table) {
$table->bigIncrements('id');
$table->foreign('photo_id')->references('id')->on('photo');
$table->string("price");
$table->bigInteger("description");
$table->string("km");
$table->string("lincenseplatecolor");
$table->string("color");
$table->string("name");
$table->boolean("sold");
$table->string("motortype");
$table->string("brand");
$table->string("topspeed");
$table->string("contstructionYear");
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('scooter');
}
} перенос фотографий:
class CreatePhotoTable extends Migration
{
public function up()
{
Schema::create('photo', function (Blueprint $table) {
$table->bigIncrements('id');
$table->string('src');
$table->timestamps();
});
}
public function down()
{
Schema::dropIfExists('photo');
}
}
я не понимаю, что я делаю неправильно, и люблю, если вы, ребята, знаете, awnser (: