Я начинающий веб-разработчик. Я делаю свой проект в Laravel 7.
У меня есть этот код:
Миграция:
Schema::create('products', function (Blueprint $table) {
$table->id();
$table->string('name', 155);
$table->string('title', 155);
$table->string('description', 155)->nullable();
$table->string('keywords', 155)->nullable();
$table->longText('content')->nullable();
$table->string('delivery_time', 155)->nullable();
$table->string('small_description', 155)->nullable();
$table->smallInteger('vat_id')->unsigned()->default(1);
$table->foreign('vat_id')->references('id')->on('vat');
$table->bigInteger('category_id')->unsigned()->default(0);
//$table->foreign('category_id')->references('id')->on('categories');
$table->char('enable', 1)->default(0);
$table->char('product_type', 1)->default(0);
$table->string('slug', 160)->nullable();
$table->engine = "InnoDB";
$table->charset = 'utf8mb4';
$table->collation = 'utf8mb4_unicode_ci';
});
Schema::create('selected_product_features', function (Blueprint $table) {
$table->id();
$table->bigInteger('product_id')->unsigned();
$table->foreign('product_id')->references('id')->on('products')->onDelete('cascade');
$table->bigInteger('feature_id')->unsigned();
$table->foreign('feature_id')->references('id')->on('product_features')->onDelete('cascade');
$table->string('key', 50);
$table->text('description')->nullable();;
$table->timestamps();
});
Мне нужно показать все продукты в форме selected_product_features key = " -2 "и description = 1.
Как это сделать?