How to get search value from translated table in laravel?
up vote
0
down vote
favorite
I have an activity table with id in it and activity translated table where all the translated dated are store along with activity_id.
I want to get eloquent from this relationship where activity name is given language
below is my migration
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');
});
i want to search activity with different language and different region and other parameters and return in eloquent
php mysql laravel eloquent
add a comment |
up vote
0
down vote
favorite
I have an activity table with id in it and activity translated table where all the translated dated are store along with activity_id.
I want to get eloquent from this relationship where activity name is given language
below is my migration
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');
});
i want to search activity with different language and different region and other parameters and return in eloquent
php mysql laravel eloquent
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have an activity table with id in it and activity translated table where all the translated dated are store along with activity_id.
I want to get eloquent from this relationship where activity name is given language
below is my migration
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');
});
i want to search activity with different language and different region and other parameters and return in eloquent
php mysql laravel eloquent
I have an activity table with id in it and activity translated table where all the translated dated are store along with activity_id.
I want to get eloquent from this relationship where activity name is given language
below is my migration
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');
});
i want to search activity with different language and different region and other parameters and return in eloquent
php mysql laravel eloquent
php mysql laravel eloquent
edited Nov 10 at 15:00
asked Nov 4 at 16:40
Chandra Ghimire
32
32
add a comment |
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53142994%2fhow-to-get-search-value-from-translated-table-in-laravel%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown