Как получить значение поиска из переведенной таблицы в laravel? - PullRequest
0 голосов
/ 04 ноября 2018

У меня есть таблица действий с идентификатором в ней и переведенная таблица действий, где все переведенные даты хранятся вместе с идентификатором_ действия.

Я хочу быть красноречивым из этих отношений, где название деятельности дается язык ниже моя миграция

 Schema::create('activity_types', function (Blueprint $table) {
 $table->increments('id');
 $table->boolean('flag');
 $table->timestamps();
 });
 Schema::create('activity_type_translations', function (Blueprint $table) {
 $table->increments('id');
 $table->string('name');
 $table->string('slug');
 $table->string('description');
 $table->integer('activity_type_id')->unsigned();
 $table->string('locale')->index();
 $table->timestamps();
 $table->unique(['activity_type_id','locale']);
 $table->foreign('activity_type_id')->references('id')->on('activity_types')->onDelete('cascade');
 });
 Schema::create('activities', function (Blueprint $table) {
 $table->increments('id');
 $table->string('code');
 $table->integer('country_id')->unsigned();
 $table->integer('activity_type_id')->unsigned();
 $table->integer('region_id')->unsigned();
 $table->string('feature_image');
 $table->string('route_map')->nullable();
 $table->boolean('flag');
 $table->timestamps();
 $table->foreign('country_id')->references('id')->on('countries')->onDelete('cascade');
 $table->foreign('activity_type_id')->references('id')->on('activity_types')->onDelete('cascade');
 $table->foreign('region_id')->references('id')->on('regions')->onDelete('cascade');
 });
 Schema::create('activity_translations', function (Blueprint $table) {
 $table->increments('id');
 $table->string('name');
 $table->string('duration');
 $table->string('trek_duration');
 $table->string('trek_grade');
 $table->string('accomodation');
 $table->string('meal');
 $table->string('max_altitude');
 $table->string('best_time');
 $table->string('max_group_size');
 $table->string('individual_cost');
 $table->string('group_cost');
 $table->text('summary');
 $table->text('overview');
 $table->text('itinenary');
 $table->text('important_note');
 $table->text('cost_include');
 $table->text('cost_exclude');
 $table->text('equipment_checklist');
 $table->text('before_you_go');
 $table->enum('trip_status', ['booking open', 'join a group']);
 $table->integer('activity_id')->unsigned();
 $table->string('locale')->index();
 $table->timestamps();
 $table->unique(['activity_id','locale']);
 $table->foreign('activity_id')->references('id')->on('activities')->onDelete('cascade');
 });

Я хочу выполнить поиск активности с другим языком и другим регионом и другими параметрами и вернуть в красноречивом

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...