Commit 586291a3 by Aan Choesni Herlingga

backend bahasa jerman

parent 45aadf57
...@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Webprofile\Backend; ...@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Webprofile\Backend;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Repositories\Webprofile\CategoryRepository; use App\Repositories\Webprofile\CategoryRepository;
use App\Repositories\Webprofile\De\CategoryRepository as DeCategoryRepository;
use App\Repositories\Webprofile\En\CategoryRepository as EnCategoryRepository; use App\Repositories\Webprofile\En\CategoryRepository as EnCategoryRepository;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Statickidz\GoogleTranslate; use Statickidz\GoogleTranslate;
...@@ -12,16 +13,20 @@ class CategoryController extends Controller ...@@ -12,16 +13,20 @@ class CategoryController extends Controller
{ {
private $repo; private $repo;
private $repoEn; private $repoEn;
private $repoDe;
private $SOURCE = 'id'; private $SOURCE = 'id';
private $TARGET = 'en'; private $TARGET = 'en';
private $TARGETDE = 'de';
public function __construct( public function __construct(
CategoryRepository $repo, CategoryRepository $repo,
EnCategoryRepository $repoEn EnCategoryRepository $repoEn,
DeCategoryRepository $repoDe
) { ) {
$this->repo = $repo; $this->repo = $repo;
$this->repoEn = $repoEn; $this->repoEn = $repoEn;
$this->repoDe = $repoDe;
} }
/** /**
...@@ -64,6 +69,7 @@ class CategoryController extends Controller ...@@ -64,6 +69,7 @@ class CategoryController extends Controller
$category = $this->repo->store($data); $category = $this->repo->store($data);
$this->createEn($data, $category); $this->createEn($data, $category);
$this->createDe($data, $category);
return redirect()->route('category.index'); return redirect()->route('category.index');
} }
...@@ -79,6 +85,17 @@ class CategoryController extends Controller ...@@ -79,6 +85,17 @@ class CategoryController extends Controller
$this->repoEn->store($dataEn); $this->repoEn->store($dataEn);
} }
private function createDe($data, $category)
{
$trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETDE, $data['name']);
$dataDe['category_id'] = $category->id;
$dataDe['name'] = $name;
$this->repoDe->store($dataDe);
}
/** /**
* Display the specified resource. * Display the specified resource.
* *
...@@ -99,7 +116,7 @@ class CategoryController extends Controller ...@@ -99,7 +116,7 @@ class CategoryController extends Controller
*/ */
public function edit($id) public function edit($id)
{ {
$data = $this->repo->findId($id); $data = $this->repo->findId($id, ['rEn', 'rDe']);
$data = [ $data = [
'data' => $data, 'data' => $data,
...@@ -117,8 +134,9 @@ class CategoryController extends Controller ...@@ -117,8 +134,9 @@ class CategoryController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$data = $request->except(['_token', 'id', 'name_en']); $data = $request->except(['_token', 'id', 'name_en', 'name_de']);
$dataEn = $request->except(['_token', 'id']); $dataEn = $request->except(['_token', 'id', 'name_de']);
$dataDe = $request->except(['_token', 'id', 'name', 'name_en']);
array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0; array_key_exists('is_active', $data) ? $data['is_active'] = 1 : $data['is_active'] = 0;
...@@ -126,6 +144,7 @@ class CategoryController extends Controller ...@@ -126,6 +144,7 @@ class CategoryController extends Controller
$edit = $this->repo->update($data, $category); $edit = $this->repo->update($data, $category);
$this->updateEn($dataEn, $category); $this->updateEn($dataEn, $category);
$this->updateDe($dataDe, $category);
return redirect()->route('category.index'); return redirect()->route('category.index');
} }
...@@ -137,6 +156,13 @@ class CategoryController extends Controller ...@@ -137,6 +156,13 @@ class CategoryController extends Controller
$this->repoEn->update($dataEn, $category->rEn); $this->repoEn->update($dataEn, $category->rEn);
} }
public function updateDe($data, $category)
{
$dataDe['name'] = $data['name_de'];
$this->repoEn->update($dataDe, $category->rDe);
}
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
......
...@@ -2,27 +2,32 @@ ...@@ -2,27 +2,32 @@
namespace App\Http\Controllers\Webprofile\Backend; namespace App\Http\Controllers\Webprofile\Backend;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Webprofile\Categories; use App\Models\Webprofile\Categories;
use App\Repositories\Webprofile\De\InformationRepository as DeInformationRepository;
use App\Repositories\Webprofile\En\InformationRepository as EnInformationRepository; use App\Repositories\Webprofile\En\InformationRepository as EnInformationRepository;
use App\Repositories\Webprofile\InformationRepository; use App\Repositories\Webprofile\InformationRepository;
use Illuminate\Http\Request;
use Statickidz\GoogleTranslate; use Statickidz\GoogleTranslate;
class InformationController extends Controller class InformationController extends Controller
{ {
private $repo; private $repo;
private $repoEn; private $repoEn;
private $repoDe;
private $SOURCE = 'id'; private $SOURCE = 'id';
private $TARGET = 'en'; private $TARGET = 'en';
private $TARGETDE = 'de';
public function __construct( public function __construct(
InformationRepository $repo, InformationRepository $repo,
EnInformationRepository $repoEn EnInformationRepository $repoEn,
DeInformationRepository $repoDe
) { ) {
$this->repo = $repo; $this->repo = $repo;
$this->repoEn = $repoEn; $this->repoEn = $repoEn;
$this->repoDe = $repoDe;
} }
/** /**
...@@ -60,8 +65,6 @@ class InformationController extends Controller ...@@ -60,8 +65,6 @@ class InformationController extends Controller
/** /**
* Store a newly created resource in storage. * Store a newly created resource in storage.
* *
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function store(Request $request) public function store(Request $request)
...@@ -76,6 +79,7 @@ class InformationController extends Controller ...@@ -76,6 +79,7 @@ class InformationController extends Controller
if (webprofilesetting()['auto_translate'] == 1) { if (webprofilesetting()['auto_translate'] == 1) {
// save translate // save translate
$this->createEn($data, $save); $this->createEn($data, $save);
$this->createDe($data, $save);
} }
return redirect()->route('informations.index'); return redirect()->route('informations.index');
...@@ -99,6 +103,24 @@ class InformationController extends Controller ...@@ -99,6 +103,24 @@ class InformationController extends Controller
$this->repoEn->store($dataEn); $this->repoEn->store($dataEn);
} }
private function createDe($data, $information)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETDE, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content']));
$dataDe['information_id'] = $information->id;
$dataDe['title'] = $title;
$dataDe['content'] = $content;
$this->repoDe->store($dataDe);
}
/** /**
* Display the specified resource. * Display the specified resource.
* *
...@@ -133,23 +155,23 @@ class InformationController extends Controller ...@@ -133,23 +155,23 @@ class InformationController extends Controller
/** /**
* Update the specified resource in storage. * Update the specified resource in storage.
* *
* @param \Illuminate\Http\Request $request
* @param int $id * @param int $id
* *
* @return \Illuminate\Http\Response * @return \Illuminate\Http\Response
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$data = $request->except(['_token', 'id', 'title_en', 'content_en']); $data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de']);
$dataEn = $request->except(['_token', 'id']); $dataEn = $request->except(['_token', 'id']);
array_key_exists('info_status', $data) ? $data['info_status'] = 1 : $data['info_status'] = 0; array_key_exists('info_status', $data) ? $data['info_status'] = 1 : $data['info_status'] = 0;
$data['slug'] = str_slug($request->input('title')); $data['slug'] = str_slug($request->input('title'));
$information = $this->repo->findId($id, ['rEn']); $information = $this->repo->findId($id, ['rEn', 'rDe']);
$edit = $this->repo->update($data, $information); $edit = $this->repo->update($data, $information);
$this->updateEn($dataEn, $information); $this->updateEn($dataEn, $information);
$this->updateDe($dataEn, $information);
return redirect()->route('informations.index'); return redirect()->route('informations.index');
} }
...@@ -162,6 +184,14 @@ class InformationController extends Controller ...@@ -162,6 +184,14 @@ class InformationController extends Controller
$this->repoEn->update($dataEn, $information); $this->repoEn->update($dataEn, $information);
} }
public function updateDe($data, $information)
{
$dataDe['title'] = $data['title_de'];
$dataDe['content'] = $data['content_de'];
$this->repoDe->update($dataDe, $information);
}
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
......
...@@ -6,6 +6,7 @@ use Alert; ...@@ -6,6 +6,7 @@ use Alert;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Webprofile\Menu; use App\Models\Webprofile\Menu;
use App\Models\Webprofile\Pages; use App\Models\Webprofile\Pages;
use App\Repositories\Webprofile\De\MenuRepository as DeMenuRepository;
use App\Repositories\Webprofile\En\MenuRepository; use App\Repositories\Webprofile\En\MenuRepository;
use App\Repositories\Webprofile\MenuRepository as WebprofileMenuRepository; use App\Repositories\Webprofile\MenuRepository as WebprofileMenuRepository;
use Auth; use Auth;
...@@ -18,12 +19,15 @@ class MenuController extends Controller ...@@ -18,12 +19,15 @@ class MenuController extends Controller
{ {
private $SOURCE = 'id'; private $SOURCE = 'id';
private $TARGET = 'en'; private $TARGET = 'en';
private $TARGETDE = 'de';
public function __construct( public function __construct(
MenuRepository $repoEn, MenuRepository $repoEn,
WebprofileMenuRepository $repo WebprofileMenuRepository $repo,
DeMenuRepository $repoDe
) { ) {
$this->repoEn = $repoEn; $this->repoEn = $repoEn;
$this->repoDe = $repoDe;
$this->repo = $repo; $this->repo = $repo;
} }
...@@ -188,6 +192,7 @@ class MenuController extends Controller ...@@ -188,6 +192,7 @@ class MenuController extends Controller
$save = Menu::create($data); $save = Menu::create($data);
$this->createEn($data, $save); $this->createEn($data, $save);
$this->createDe($data, $save);
Alert::success('Data berhasil disimpan')->persistent('Ok'); Alert::success('Data berhasil disimpan')->persistent('Ok');
...@@ -212,6 +217,21 @@ class MenuController extends Controller ...@@ -212,6 +217,21 @@ class MenuController extends Controller
$this->repoEn->store($dataEn); $this->repoEn->store($dataEn);
} }
private function createDe($data, $menu, $translate = 1)
{
if ($translate == 1) {
$trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETDE, $data['name']);
} else {
$name = $data['name'];
}
$dataDe['menu_id'] = $menu->id;
$dataDe['name'] = $name;
$this->repoDe->store($dataDe);
}
public function storepage(Request $request) public function storepage(Request $request)
{ {
$data = $request->except('_token'); $data = $request->except('_token');
...@@ -252,6 +272,7 @@ class MenuController extends Controller ...@@ -252,6 +272,7 @@ class MenuController extends Controller
$data['name'] = $page->rEn->title; $data['name'] = $page->rEn->title;
$this->createEn($data, $save, 'notTranslate'); $this->createEn($data, $save, 'notTranslate');
$this->createDe($data, $save, 'notTranslate');
Alert::success('Data berhasil disimpan')->persistent('Ok'); Alert::success('Data berhasil disimpan')->persistent('Ok');
...@@ -281,7 +302,7 @@ class MenuController extends Controller ...@@ -281,7 +302,7 @@ class MenuController extends Controller
{ {
$id = Crypt::decrypt($id); $id = Crypt::decrypt($id);
$setting = webprofilesetting(); $setting = webprofilesetting();
$data = $this->repo->findId($id, ['rEn']); $data = $this->repo->findId($id, ['rEn', 'rDe']);
$data = [ $data = [
'data' => $data, 'data' => $data,
...@@ -301,13 +322,17 @@ class MenuController extends Controller ...@@ -301,13 +322,17 @@ class MenuController extends Controller
$data = $request->except(['_token', 'id']); $data = $request->except(['_token', 'id']);
$data['name'] = $data['titleiid']; $data['name'] = $data['titleiid'];
$menu = $this->repo->findId($id, ['rEn']); $menu = $this->repo->findId($id, ['rEn', 'rDe']);
$this->repo->update($data, $menu); $this->repo->update($data, $menu);
$dataEn['name'] = $data['titleien']; $dataEn['name'] = $data['titleien'];
$menuEn = $this->repoEn->findId($menu->rEn->id); $menuEn = $this->repoEn->findId($menu->rEn->id);
$this->repoEn->update($dataEn, $menuEn); $this->repoEn->update($dataEn, $menuEn);
$dataDe['name'] = $data['titleide'];
$menuDe = $this->repoDe->findId($menu->rDe->id);
$this->repoDe->update($dataDe, $menuDe);
return redirect()->route('menu.index'); return redirect()->route('menu.index');
} }
......
...@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Webprofile\Backend; ...@@ -4,6 +4,7 @@ namespace App\Http\Controllers\Webprofile\Backend;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Webprofile\Categories; use App\Models\Webprofile\Categories;
use App\Repositories\Webprofile\De\PagesRepository as DePagesRepository;
use App\Repositories\Webprofile\En\PagesRepository as EnPagesRepository; use App\Repositories\Webprofile\En\PagesRepository as EnPagesRepository;
use App\Repositories\Webprofile\PagesRepository; use App\Repositories\Webprofile\PagesRepository;
use Illuminate\Http\Request; use Illuminate\Http\Request;
...@@ -13,16 +14,20 @@ class PageController extends Controller ...@@ -13,16 +14,20 @@ class PageController extends Controller
{ {
private $repo; private $repo;
private $repoEn; private $repoEn;
private $repoDe;
private $SOURCE = 'id'; private $SOURCE = 'id';
private $TARGET = 'en'; private $TARGET = 'en';
private $TARGETDE = 'de';
public function __construct( public function __construct(
PagesRepository $repo, PagesRepository $repo,
EnPagesRepository $repoEn EnPagesRepository $repoEn,
DePagesRepository $repoDe
) { ) {
$this->repo = $repo; $this->repo = $repo;
$this->repoEn = $repoEn; $this->repoEn = $repoEn;
$this->repoDe = $repoDe;
} }
/** /**
...@@ -73,6 +78,7 @@ class PageController extends Controller ...@@ -73,6 +78,7 @@ class PageController extends Controller
// save translate // save translate
if (strlen($data['content']) < 5000) { if (strlen($data['content']) < 5000) {
$this->createEn($data, $save); $this->createEn($data, $save);
$this->createDe($data, $save);
} }
} }
...@@ -97,6 +103,24 @@ class PageController extends Controller ...@@ -97,6 +103,24 @@ class PageController extends Controller
$this->repoEn->store($dataEn); $this->repoEn->store($dataEn);
} }
private function createDe($data, $page)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETDE, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content']));
$dataDe['page_id'] = $page->id;
$dataDe['title'] = $title;
$dataDe['content'] = $content;
$this->repoDe->store($dataDe);
}
/** /**
* Display the specified resource. * Display the specified resource.
* *
...@@ -137,13 +161,14 @@ class PageController extends Controller ...@@ -137,13 +161,14 @@ class PageController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$data = $request->except(['_token', 'id', 'title_en', 'content_en']); $data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de']);
$dataEn = $request->except(['_token', 'id']); $dataEn = $request->except(['_token', 'id']);
$page = $this->repo->findId($id, ['rEn']); $page = $this->repo->findId($id, ['rEn', 'rDe']);
$edit = $this->repo->update($data, $page); $edit = $this->repo->update($data, $page);
$this->updateEn($dataEn, $page); $this->updateEn($dataEn, $page);
$this->updateDe($dataEn, $page);
return redirect()->route('pages.index'); return redirect()->route('pages.index');
} }
...@@ -156,6 +181,14 @@ class PageController extends Controller ...@@ -156,6 +181,14 @@ class PageController extends Controller
$this->repoEn->update($dataEn, $page); $this->repoEn->update($dataEn, $page);
} }
public function updateDe($data, $page)
{
$dataDe['title'] = $data['title_de'];
$dataDe['content'] = $data['content_de'];
$this->repoDe->update($dataDe, $page);
}
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
......
...@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Webprofile\Backend; ...@@ -5,6 +5,7 @@ namespace App\Http\Controllers\Webprofile\Backend;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Models\Webprofile\Categories; use App\Models\Webprofile\Categories;
use App\Repositories\Webprofile\AutopostRepository; use App\Repositories\Webprofile\AutopostRepository;
use App\Repositories\Webprofile\De\PostRepository as DePostRepository;
use App\Repositories\Webprofile\En\PostRepository as EnPostRepository; use App\Repositories\Webprofile\En\PostRepository as EnPostRepository;
use App\Repositories\Webprofile\PostRepository; use App\Repositories\Webprofile\PostRepository;
use App\Repositories\Webprofile\SocialSharingRepository; use App\Repositories\Webprofile\SocialSharingRepository;
...@@ -18,13 +19,16 @@ class PostController extends Controller ...@@ -18,13 +19,16 @@ class PostController extends Controller
{ {
private $repo; private $repo;
private $repoEn; private $repoEn;
private $repoDe;
private $SOURCE = 'id'; private $SOURCE = 'id';
private $TARGET = 'en'; private $TARGET = 'en';
private $TARGETDE = 'de';
public function __construct( public function __construct(
PostRepository $repo, PostRepository $repo,
EnPostRepository $repoEn, EnPostRepository $repoEn,
DePostRepository $repoDe,
SocialSharingRepository $socialRepo, SocialSharingRepository $socialRepo,
AutopostRepository $autoPostRepo AutopostRepository $autoPostRepo
) { ) {
...@@ -32,6 +36,7 @@ class PostController extends Controller ...@@ -32,6 +36,7 @@ class PostController extends Controller
$this->repoEn = $repoEn; $this->repoEn = $repoEn;
$this->socialRepo = $socialRepo; $this->socialRepo = $socialRepo;
$this->autoPostRepo = $autoPostRepo; $this->autoPostRepo = $autoPostRepo;
$this->repoDe = $repoDe;
} }
/** /**
...@@ -93,6 +98,7 @@ class PostController extends Controller ...@@ -93,6 +98,7 @@ class PostController extends Controller
// save translate // save translate
if (strlen($data['content']) < 5000) { if (strlen($data['content']) < 5000) {
$this->createEn($data, $save); $this->createEn($data, $save);
$this->createDe($data, $save);
} }
} }
...@@ -182,6 +188,24 @@ class PostController extends Controller ...@@ -182,6 +188,24 @@ class PostController extends Controller
$this->repoEn->store($dataEn); $this->repoEn->store($dataEn);
} }
private function createDe($data, $post)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETDE, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content']));
$dataDe['post_id'] = $post->id;
$dataDe['title'] = $title;
$dataDe['content'] = $content;
$this->repoDe->store($dataDe);
}
/** /**
* Display the specified resource. * Display the specified resource.
* *
...@@ -224,7 +248,7 @@ class PostController extends Controller ...@@ -224,7 +248,7 @@ class PostController extends Controller
*/ */
public function update(Request $request, $id) public function update(Request $request, $id)
{ {
$data = $request->except(['_token', 'id', 'title_en', 'content_en']); $data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de']);
$dataEn = $request->except(['_token', 'id']); $dataEn = $request->except(['_token', 'id']);
array_key_exists('post_status', $data) ? $data['post_status'] = 1 : $data['post_status'] = 0; array_key_exists('post_status', $data) ? $data['post_status'] = 1 : $data['post_status'] = 0;
...@@ -243,6 +267,7 @@ class PostController extends Controller ...@@ -243,6 +267,7 @@ class PostController extends Controller
} }
$this->updateEn($dataEn, $post); $this->updateEn($dataEn, $post);
$this->updateDe($dataEn, $post);
return redirect()->route('posts.index'); return redirect()->route('posts.index');
} }
...@@ -255,6 +280,14 @@ class PostController extends Controller ...@@ -255,6 +280,14 @@ class PostController extends Controller
$this->repoEn->update($dataEn, $post); $this->repoEn->update($dataEn, $post);
} }
public function updateDe($data, $post)
{
$dataDe['title'] = $data['title_de'];
$dataDe['content'] = $data['content_de'];
$this->repoDe->update($dataDe, $post);
}
/** /**
* Remove the specified resource from storage. * Remove the specified resource from storage.
* *
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Models\Webprofile; namespace App\Models\Webprofile;
use App\Http\Traits\UuidTrait; use App\Http\Traits\UuidTrait;
use App\Models\Webprofile\De\Categories as DeCategories;
use App\Models\Webprofile\En\Categories as EnCategories; use App\Models\Webprofile\En\Categories as EnCategories;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
...@@ -24,4 +25,9 @@ class Categories extends Model ...@@ -24,4 +25,9 @@ class Categories extends Model
{ {
return $this->hasOne(EnCategories::class, 'category_id', 'id'); return $this->hasOne(EnCategories::class, 'category_id', 'id');
} }
public function rDe()
{
return $this->hasOne(DeCategories::class, 'category_id', 'id');
}
} }
<?php
namespace App\Models\Webprofile\De;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Categories extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_categories_de';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\De;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Information extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_informations_de';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\De;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Menu extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_menus_de';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\De;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Pages extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_pages_de';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\De;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Posts extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_posts_de';
protected $guarded = [];
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Models\Webprofile; namespace App\Models\Webprofile;
use App\Http\Traits\UuidTrait; use App\Http\Traits\UuidTrait;
use App\Models\Webprofile\De\Information as DeInformation;
use App\Models\Webprofile\En\Information as EnInformation; use App\Models\Webprofile\En\Information as EnInformation;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
...@@ -19,4 +20,9 @@ class Information extends Model ...@@ -19,4 +20,9 @@ class Information extends Model
{ {
return $this->hasOne(EnInformation::class, 'information_id', 'id'); return $this->hasOne(EnInformation::class, 'information_id', 'id');
} }
public function rDe()
{
return $this->hasOne(DeInformation::class, 'information_id', 'id');
}
} }
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
namespace App\Models\Webprofile; namespace App\Models\Webprofile;
use App\Http\Traits\UuidTrait; use App\Http\Traits\UuidTrait;
use App\Models\Webprofile\De\Menu as DeMenu;
use App\Models\Webprofile\En\Menu as EnMenu; use App\Models\Webprofile\En\Menu as EnMenu;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
...@@ -30,6 +31,11 @@ class Menu extends Model ...@@ -30,6 +31,11 @@ class Menu extends Model
return $this->hasOne(EnMenu::class, 'menu_id', 'id'); return $this->hasOne(EnMenu::class, 'menu_id', 'id');
} }
public function rDe()
{
return $this->hasOne(DeMenu::class, 'menu_id', 'id');
}
public function rChild() public function rChild()
{ {
return $this->hasMany(Menu::class, 'parent', 'id')->orderBy('urutan', 'asc')->with(['rChild', 'rEn']); return $this->hasMany(Menu::class, 'parent', 'id')->orderBy('urutan', 'asc')->with(['rChild', 'rEn']);
......
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
namespace App\Models\Webprofile; namespace App\Models\Webprofile;
use App\Http\Traits\UuidTrait; use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model; use App\Models\Webprofile\De\Pages as DePages;
use App\Models\Webprofile\Categories;
use App\Models\Webprofile\En\Pages as EnPages; use App\Models\Webprofile\En\Pages as EnPages;
use Illuminate\Database\Eloquent\Model;
class Pages extends Model class Pages extends Model
{ {
...@@ -20,4 +20,9 @@ class Pages extends Model ...@@ -20,4 +20,9 @@ class Pages extends Model
{ {
return $this->hasOne(EnPages::class, 'page_id', 'id'); return $this->hasOne(EnPages::class, 'page_id', 'id');
} }
public function rDe()
{
return $this->hasOne(DePages::class, 'page_id', 'id');
}
} }
...@@ -3,9 +3,9 @@ ...@@ -3,9 +3,9 @@
namespace App\Models\Webprofile; namespace App\Models\Webprofile;
use App\Http\Traits\UuidTrait; use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model; use App\Models\Webprofile\De\Posts as DePosts;
use App\Models\Webprofile\Categories;
use App\Models\Webprofile\En\Posts as EnPosts; use App\Models\Webprofile\En\Posts as EnPosts;
use Illuminate\Database\Eloquent\Model;
class Posts extends Model class Posts extends Model
{ {
...@@ -25,4 +25,9 @@ class Posts extends Model ...@@ -25,4 +25,9 @@ class Posts extends Model
{ {
return $this->hasOne(EnPosts::class, 'post_id', 'id'); return $this->hasOne(EnPosts::class, 'post_id', 'id');
} }
public function rDe()
{
return $this->hasOne(DePosts::class, 'post_id', 'id');
}
} }
<?php
namespace App\Repositories\Webprofile\De;
use App\Models\Webprofile\De\Categories;
use App\Repositories\Repository;
class CategoryRepository extends Repository
{
public function __construct(Categories $model)
{
$this->model = $model;
}
public function get()
{
}
public function paginate()
{
}
}
<?php
namespace App\Repositories\Webprofile\De;
use App\Models\Webprofile\De\Information;
use App\Repositories\Repository;
class InformationRepository extends Repository
{
public function __construct(Information $model)
{
$this->model = $model;
}
public function get()
{
}
public function paginate()
{
}
public function update($data, $information)
{
return $this->model->updateOrCreate([
'information_id' => $information->id,
], $data);
}
}
<?php
namespace App\Repositories\Webprofile\De;
use App\Models\Webprofile\De\Menu;
use App\Repositories\Repository;
class MenuRepository extends Repository
{
public function __construct(Menu $model)
{
$this->model = $model;
}
public function get()
{
}
public function paginate()
{
}
}
<?php
namespace App\Repositories\Webprofile\De;
use App\Models\Webprofile\De\Pages;
use App\Repositories\Repository;
class PagesRepository extends Repository
{
public function __construct(Pages $model)
{
$this->model = $model;
}
public function get()
{
}
public function paginate()
{
}
public function update($data, $page)
{
return $this->model->updateOrCreate([
'page_id' => $page->id,
], $data);
}
}
<?php
namespace App\Repositories\Webprofile\De;
use App\Models\Webprofile\De\Posts;
use App\Repositories\Repository;
class PostRepository extends Repository
{
public function __construct(Posts $model)
{
$this->model = $model;
}
public function get()
{
}
public function paginate()
{
}
public function update($data, $post)
{
return $this->model->updateOrCreate([
'post_id' => $post->id,
], $data);
}
}
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
class CreateDeTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('swp_categories_de', function (Blueprint $table) {
$table->string('id', 36)->primary();
$table->string('category_id', 36);
$table->string('name');
$table->string('userid_created', 36)->nullable();
$table->string('userid_updated', 36)->nullable();
$table->timestamps();
});
Schema::create('swp_posts_de', function (Blueprint $table) {
$table->string('id', 36)->primary();
$table->string('post_id', 36);
$table->string('title');
$table->text('content')->nullable();
$table->string('userid_created', 36)->nullable();
$table->string('userid_updated', 36)->nullable();
$table->timestamps();
});
Schema::create('swp_informations_de', function (Blueprint $table) {
$table->string('id', 36)->primary();
$table->string('information_id', 36);
$table->string('title');
$table->text('content')->nullable();
$table->string('userid_created', 36)->nullable();
$table->string('userid_updated', 36)->nullable();
$table->timestamps();
});
Schema::create('swp_menus_de', 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();
});
Schema::create('swp_pages_de', function (Blueprint $table) {
$table->string('id', 36)->primary();
$table->string('page_id', 36);
$table->string('title');
$table->text('content')->nullable();
$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_categories_de');
Schema::dropIfExists('swp_posts_de');
Schema::dropIfExists('swp_informations_de');
Schema::dropIfExists('swp_menus_de');
Schema::dropIfExists('swp_pages_de');
}
}
...@@ -49,6 +49,20 @@ ...@@ -49,6 +49,20 @@
</div> </div>
</div> </div>
</div> </div>
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
deutsche Sprache
</div>
<div class="col-md-12">
<div class="form-group @if ($errors->has('name_de')) has-error @endif">
<label class="col-md-2 control-label">Kategorie</label>
<div class="col-md-10">
{{ Form::text('name_de', $data->rDe->name, array('class' => 'form-control', 'required')) }}
@if ($errors->has('name_de'))
<label id="login-error" class="error" for="login">{{$errors->first('name_de')}}</label>
@endif
</div>
</div>
</div>
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group" style="padding-top: 10px;"> <div class="form-group" style="padding-top: 10px;">
<label class="col-md-2 control-label">Status</label> <label class="col-md-2 control-label">Status</label>
......
...@@ -49,18 +49,20 @@ ...@@ -49,18 +49,20 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="tabs">
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#inggris" role="tab" data-toggle="tab" aria-expanded="true">Inggris</a></li>
<li class=""><a href="#jerman" role="tab" data-toggle="tab" aria-expanded="false">Jerman</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="inggris">
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;"> <div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
English Language English Language
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group @if ($errors->has('title')) has-error @endif"> <div class="form-group @if ($errors->has('title')) has-error @endif">
<div class="col-md-12"> <div class="col-md-12">
@if($data->rEn) {{ Form::text('title_en', $data->rEn ? $data->rEn->title : null, array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
{{ Form::text('title_en', $data->rEn ? $data->rEn->title : null, array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
@else
{{ Form::text('title_en', null, array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
@endif
@if ($errors->has('title')) @if ($errors->has('title'))
<label id="login-error" class="error" for="login">{{$errors->first('title')}}</label> <label id="login-error" class="error" for="login">{{$errors->first('title')}}</label>
@endif @endif
...@@ -69,14 +71,32 @@ ...@@ -69,14 +71,32 @@
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="block"> <div class="block">
@if ($data->rEn)
{{ Form::textarea('content_en', $data->rEn ? $data->rEn->content : null, array('id'=>'content_en')) }} {{ Form::textarea('content_en', $data->rEn ? $data->rEn->content : null, array('id'=>'content_en')) }}
@else </div>
{{ Form::textarea('content_en', null, array('id'=>'content_en')) }} </div>
</div>
<div class="tab-pane" id="jerman">
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
deutsche Sprache
</div>
<div class="col-md-12">
<div class="form-group @if ($errors->has('title')) has-error @endif">
<div class="col-md-12">
{{ Form::text('title_de', $data->rDe ? $data->rDe->title : null, array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
@if ($errors->has('title'))
<label id="login-error" class="error" for="login">{{$errors->first('title')}}</label>
@endif @endif
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-12">
<div class="block">
{{ Form::textarea('content_de', $data->rDe ? $data->rDe->content : null, array('id'=>'content_de')) }}
</div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -177,10 +197,13 @@ ...@@ -177,10 +197,13 @@
$(document).ready(function() { $(document).ready(function() {
$('#content').summernote({ $('#content').summernote({
height: 400 height: 350
}); });
$('#content_en').summernote({ $('#content_en').summernote({
height: 400 height: 350
});
$('#content_de').summernote({
height: 350
}); });
}); });
</script> </script>
......
...@@ -40,6 +40,15 @@ ...@@ -40,6 +40,15 @@
@endif @endif
</div> </div>
</div> </div>
<div class="form-group @if ($errors->has('titleien')) has-error @endif">
<label class="col-md-2 control-label">German Title</label>
<div class="col-md-10">
{{ Form::text('titleide', $data->rDe->name, array('class' => 'form-control', 'required')) }}
@if ($errors->has('titleide'))
<label id="login-error" class="error" for="login">{{$errors->first('titleien')}}</label>
@endif
</div>
</div>
<div class="form-group @if ($errors->has('url')) has-error @endif"> <div class="form-group @if ($errors->has('url')) has-error @endif">
<label class="col-md-2 control-label">URL</label> <label class="col-md-2 control-label">URL</label>
<div class="col-md-10"> <div class="col-md-10">
......
...@@ -49,18 +49,20 @@ ...@@ -49,18 +49,20 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="tabs">
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#inggris" role="tab" data-toggle="tab" aria-expanded="true">Inggris</a></li>
<li class=""><a href="#jerman" role="tab" data-toggle="tab" aria-expanded="false">Jerman</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="inggris">
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;"> <div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
English Language English Language
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group @if ($errors->has('title')) has-error @endif"> <div class="form-group @if ($errors->has('title')) has-error @endif">
<div class="col-md-12"> <div class="col-md-12">
@if($data->rEn) {{ Form::text('title_en', $data->rEn ? $data->rEn->title : null, array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
{{ Form::text('title_en', $data->rEn ? $data->rEn->title : null, array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
@else
{{ Form::text('title_en', null, array('class' => 'form-control', 'placeholder'=>trans('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
@endif
@if ($errors->has('title')) @if ($errors->has('title'))
<label id="login-error" class="error" for="login">{{$errors->first('title')}}</label> <label id="login-error" class="error" for="login">{{$errors->first('title')}}</label>
@endif @endif
...@@ -69,14 +71,32 @@ ...@@ -69,14 +71,32 @@
</div> </div>
<div class="col-md-12"> <div class="col-md-12">
<div class="block"> <div class="block">
@if ($data->rEn)
{{ Form::textarea('content_en', $data->rEn ? $data->rEn->content : null, array('id'=>'content_en')) }} {{ Form::textarea('content_en', $data->rEn ? $data->rEn->content : null, array('id'=>'content_en')) }}
@else </div>
{{ Form::textarea('content_en', null, array('id'=>'content_en')) }} </div>
</div>
<div class="tab-pane" id="jerman">
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
deutsche Sprache
</div>
<div class="col-md-12">
<div class="form-group @if ($errors->has('title')) has-error @endif">
<div class="col-md-12">
{{ Form::text('title_de', $data->rDe ? $data->rDe->title : null, array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
@if ($errors->has('title'))
<label id="login-error" class="error" for="login">{{$errors->first('title')}}</label>
@endif @endif
</div> </div>
</div> </div>
</div> </div>
<div class="col-md-12">
<div class="block">
{{ Form::textarea('content_de', $data->rDe ? $data->rDe->content : null, array('id'=>'content_de')) }}
</div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -139,10 +159,13 @@ ...@@ -139,10 +159,13 @@
$(document).ready(function() { $(document).ready(function() {
$('#content').summernote({ $('#content').summernote({
height: 400 height: 350
}); });
$('#content_en').summernote({ $('#content_en').summernote({
height: 400 height: 350
});
$('#content_de').summernote({
height: 350
}); });
}); });
......
...@@ -59,7 +59,13 @@ ...@@ -59,7 +59,13 @@
</div> </div>
</div> </div>
</div> </div>
<div class="row"> <div class="tabs">
<ul class="nav nav-tabs" role="tablist">
<li class="active"><a href="#inggris" role="tab" data-toggle="tab" aria-expanded="true">Inggris</a></li>
<li class=""><a href="#jerman" role="tab" data-toggle="tab" aria-expanded="false">Jerman</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="inggris">
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;"> <div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
English Language English Language
</div> </div>
...@@ -79,6 +85,28 @@ ...@@ -79,6 +85,28 @@
</div> </div>
</div> </div>
</div> </div>
<div class="tab-pane" id="jerman">
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
deutsche Sprache
</div>
<div class="col-md-12">
<div class="form-group @if ($errors->has('title')) has-error @endif">
<div class="col-md-12">
{{ Form::text('title_de', $data->rDe ? $data->rDe->title : null, array('class' => 'form-control', 'placeholder'=>app('translator')->getFromJson('label.title'), 'style'=>'font-size: 14pt;', 'required')) }}
@if ($errors->has('title'))
<label id="login-error" class="error" for="login">{{$errors->first('title')}}</label>
@endif
</div>
</div>
</div>
<div class="col-md-12">
<div class="block">
{{ Form::textarea('content_de', $data->rDe ? $data->rDe->content : null, array('id'=>'content_de')) }}
</div>
</div>
</div>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
...@@ -226,14 +254,17 @@ ...@@ -226,14 +254,17 @@
$(document).ready(function() { $(document).ready(function() {
$('#content').summernote({ $('#content').summernote({
height: 400 height: 350
}); });
$('#content_en').summernote({ $('#content_en').summernote({
height: 400 height: 350
});
$('#content_de').summernote({
height: 350
}); });
}); });
$('#categories').select2(); $('#categories').select2();
$('#categories_en').select2();
</script> </script>
@stop @stop
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