Commit ac673cec by Aan Choesni Herlingga

translate menu en

parent e40501de
...@@ -11,9 +11,13 @@ use Uuid; ...@@ -11,9 +11,13 @@ use Uuid;
use Alert; use Alert;
use Crypt; use Crypt;
use Auth; use Auth;
use Statickidz\GoogleTranslate;
class MenuController extends Controller class MenuController extends Controller
{ {
private $SOURCE = 'id';
private $TARGET = 'en';
/** /**
* Display a listing of the resource. * Display a listing of the resource.
* *
...@@ -189,6 +193,17 @@ class MenuController extends Controller ...@@ -189,6 +193,17 @@ class MenuController extends Controller
} }
} }
private function createEn($data, $category)
{
$trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGET, $data['name']);
$dataEn['category_id'] = $category->id;
$dataEn['name'] = $name;
$this->repoEn->store($dataEn);
}
public function newstorepage(Request $request) public function newstorepage(Request $request)
{ {
$data = $request->except('_token'); $data = $request->except('_token');
......
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
class CrateMenuEnTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('swp_menus_en', function (Blueprint $table) {
$table->string('id', 36)->primary();
$table->string('menu_id', 36);
$table->string('name');
$table->string('userid_created', 36)->nullable();
$table->string('userid_updated', 36)->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('swp_menus_en');
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment