Как мне загрузить с помощью () или подобное, когда у меня ситуация, как показано ниже.сообщения со схемами post_translation.Laravel.
Я реализовал локализацию laravel с мультиязычной архитектурой в отношении этого урока (https://mydnic.be/post/how-to-build-an-efficient-and-seo-friendly-multilingual-architecture-for-your-laravel-application), и теперь, когда я вывожу данные в поле зрения, для каждых данных у меня сейчас 2 запроса (дублированных) из-заtag_translation Схема в базе данных тегов и локализация для языка 2. Как закачать, чтобы показать только связанные запросы, не дублированные .?!
введите описание изображения здесь
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTagsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tags', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
Schema::create('tag_translations', function (Blueprint $table) {
$table->increments('id');
$table->integer('tag_id')->unsigned();
$table->string('locale')->index();
// The actual fields to store the content of your entity. You can add whatever you need.
$table->string('name');
$table->string('slug')->unique();
$table->unique(['tag_id', 'locale']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tags');
Schema::dropIfExists('tag_translations');
}
}
Другой пример количества запросов:
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CreateTagsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('tags', function (Blueprint $table) {
$table->increments('id');
$table->timestamps();
});
Schema::create('tag_translations', function (Blueprint $table) {
$table->increments('id');
$table->integer('tag_id')->unsigned();
$table->string('locale')->index();
// The actual fields to store the content of your entity. You can add whatever you need.
$table->string('name');
$table->string('slug')->unique();
$table->unique(['tag_id', 'locale']);
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('tags');
Schema::dropIfExists('tag_translations');
}
}
Спасибо за помощь!