I have two table in my database. The first is industry and the second is industry_languages.
Industry's table
Schema::create('industries', function (Blueprint $table) {
$table->increments('id');
$table->string('industry_name', 100);
$table->integer('language_id')->default(1);
$table->timestamps();
});
Industry_Languages' table
Schema::create('industry_languages', function (Blueprint $table) {
$table->increments('id');
$table->integer('industry_id');
$table->string('industry_name', 200);
$table->integer('language_id');
$table->timestamps();
});
This is my IndustryController
public function store(Request $request)
{
$industry = new Industry();
$industry->industry_name = $request->industryName;
$industry->save();
return response()->json($industry);
}
This function will only store data into industry's table with language id = 1, but I also want to store it into industry_languages' table with language id = 2 (because I have a language's table in my database with 2 row data: 'Indonesia', 'English')
Example: If I input 'Halo' in the industry_name field, It will store into my industry's table as 'Halo' in the industry_name field and '1' in the language_id field, then It will also store into my industry_languages' table as 'Hello' in the industry_name field and '2' in the language_id field
I have a problem with translating the request from the industry's table.
I have tried to use Laravel google-translate
but, it didn't work