Commit 86ff6e10 by Aan Choesni Herlingga

backend bahasa cina tradisional

parent 565c22a6
......@@ -7,6 +7,7 @@ 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\Sa\CategoryRepository as SaCategoryRepository;
use App\Repositories\Webprofile\Zh\CategoryRepository as ZhCategoryRepository;
use Illuminate\Http\Request;
use Statickidz\GoogleTranslate;
......@@ -16,22 +17,26 @@ class CategoryController extends Controller
private $repoEn;
private $repoDe;
private $repoSa;
private $repoZh;
private $SOURCE = 'id';
private $TARGET = 'en';
private $TARGETDE = 'de';
private $TARGETSA = 'ar';
private $TARGETZH = 'zh';
public function __construct(
CategoryRepository $repo,
EnCategoryRepository $repoEn,
DeCategoryRepository $repoDe,
SaCategoryRepository $repoSa
SaCategoryRepository $repoSa,
ZhCategoryRepository $repoZh
) {
$this->repo = $repo;
$this->repoEn = $repoEn;
$this->repoDe = $repoDe;
$this->repoSa = $repoSa;
$this->repoZh = $repoZh;
}
/**
......@@ -76,6 +81,7 @@ class CategoryController extends Controller
$this->createEn($data, $category);
$this->createDe($data, $category);
$this->createSa($data, $category);
$this->createZh($data, $category);
return redirect()->route('category.index');
}
......@@ -113,6 +119,17 @@ class CategoryController extends Controller
$this->repoSa->store($dataSa);
}
private function createZh($data, $category)
{
$trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETZH, $data['name']);
$dataZh['category_id'] = $category->id;
$dataZh['name'] = $name;
$this->repoZh->store($dataZh);
}
/**
* Display the specified resource.
*
......@@ -133,7 +150,7 @@ class CategoryController extends Controller
*/
public function edit($id)
{
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$data = [
'data' => $data,
......@@ -151,18 +168,19 @@ class CategoryController extends Controller
*/
public function update(Request $request, $id)
{
$data = $request->except(['_token', 'id', 'name_en', 'name_de', 'name_sa']);
$data = $request->except(['_token', 'id', 'name_en', 'name_de', 'name_sa', 'name_zh']);
$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;
$category = $this->repo->findId($id, ['rEn']);
$category = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$edit = $this->repo->update($data, $category);
$this->updateEn($dataEn, $category);
$this->updateDe($dataDe, $category);
$this->updateSa($dataEn, $category);
$this->updateZh($dataEn, $category);
return redirect()->route('category.index');
}
......@@ -209,6 +227,20 @@ class CategoryController extends Controller
}
}
public function updateZh($data, $category)
{
$dataZh['name'] = $data['name_zh'];
if ($category->rZh) {
$this->repoZh->update($dataZh, $category->rZh);
} else {
$dataZh['category_id'] = $category->id;
$dataZh['name'] = $data['name_zh'];
$this->repoZh->store($dataZh);
}
}
/**
* Remove the specified resource from storage.
*
......@@ -233,6 +265,10 @@ class CategoryController extends Controller
if ($data->rSa) {
$this->repoSa->destroy($data->rSa);
}
if ($data->rZh) {
$this->repoZh->destroy($data->rZh);
}
}
return response()->json(['done']);
......
......@@ -8,6 +8,7 @@ use App\Repositories\Webprofile\De\InformationRepository as DeInformationReposit
use App\Repositories\Webprofile\En\InformationRepository as EnInformationRepository;
use App\Repositories\Webprofile\InformationRepository;
use App\Repositories\Webprofile\Sa\InformationRepository as SaInformationRepository;
use App\Repositories\Webprofile\Zh\InformationRepository as ZhInformationRepository;
use Illuminate\Http\Request;
use Statickidz\GoogleTranslate;
......@@ -17,22 +18,26 @@ class InformationController extends Controller
private $repoEn;
private $repoDe;
private $repoSa;
private $repoZh;
private $SOURCE = 'id';
private $TARGET = 'en';
private $TARGETDE = 'de';
private $TARGETSA = 'ar';
private $TARGETZH = 'zh';
public function __construct(
InformationRepository $repo,
EnInformationRepository $repoEn,
DeInformationRepository $repoDe,
SaInformationRepository $repoSa
SaInformationRepository $repoSa,
ZhInformationRepository $repoZh
) {
$this->repo = $repo;
$this->repoEn = $repoEn;
$this->repoDe = $repoDe;
$this->repoSa = $repoSa;
$this->repoZh = $repoZh;
}
/**
......@@ -86,6 +91,7 @@ class InformationController extends Controller
$this->createEn($data, $save);
$this->createDe($data, $save);
$this->createSa($data, $save);
$this->createZh($data, $save);
}
return redirect()->route('informations.index');
......@@ -145,6 +151,24 @@ class InformationController extends Controller
$this->repoSa->store($dataSa);
}
private function createZh($data, $information)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETZH, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content']));
$dataZh['information_id'] = $information->id;
$dataZh['title'] = $title;
$dataZh['content'] = $content;
$this->repoZh->store($dataZh);
}
/**
* Display the specified resource.
*
......@@ -165,7 +189,7 @@ class InformationController extends Controller
*/
public function edit($id)
{
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$categories = Categories::pluck('name', 'id');
$data = [
......@@ -185,7 +209,7 @@ class InformationController extends Controller
*/
public function update(Request $request, $id)
{
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa']);
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa', 'title_zh', 'content_zh']);
$dataEn = $request->except(['_token', 'id']);
array_key_exists('info_status', $data) ? $data['info_status'] = 1 : $data['info_status'] = 0;
......@@ -197,6 +221,7 @@ class InformationController extends Controller
$this->updateEn($dataEn, $information);
$this->updateDe($dataEn, $information);
$this->updateSa($dataEn, $information);
$this->updateZh($dataEn, $information);
return redirect()->route('informations.index');
}
......@@ -225,6 +250,14 @@ class InformationController extends Controller
$this->repoSa->update($dataSa, $information);
}
public function updateZh($data, $information)
{
$dataZh['title'] = $data['title_zh'];
$dataZh['content'] = $data['content_zh'];
$this->repoZh->update($dataZh, $information);
}
/**
* Remove the specified resource from storage.
*
......@@ -234,7 +267,7 @@ class InformationController extends Controller
*/
public function destroy($id)
{
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$this->repo->destroy($data);
if ($data->rEn) {
......@@ -249,6 +282,10 @@ class InformationController extends Controller
$this->repoSa->destroy($data->rSa);
}
if ($data->rZh) {
$this->repoZh->destroy($data->rZh);
}
return response()->json(['done']);
}
}
......@@ -10,6 +10,7 @@ use App\Repositories\Webprofile\De\MenuRepository as DeMenuRepository;
use App\Repositories\Webprofile\En\MenuRepository;
use App\Repositories\Webprofile\MenuRepository as WebprofileMenuRepository;
use App\Repositories\Webprofile\Sa\MenuRepository as SaMenuRepository;
use App\Repositories\Webprofile\Zh\MenuRepository as ZhMenuRepository;
use Auth;
use Crypt;
use Illuminate\Http\Request;
......@@ -22,16 +23,19 @@ class MenuController extends Controller
private $TARGET = 'en';
private $TARGETDE = 'de';
private $TARGETSA = 'ar';
private $TARGETZH = 'zh';
public function __construct(
MenuRepository $repoEn,
WebprofileMenuRepository $repo,
DeMenuRepository $repoDe,
SaMenuRepository $repoSa
SaMenuRepository $repoSa,
ZhMenuRepository $repoZh
) {
$this->repoEn = $repoEn;
$this->repoDe = $repoDe;
$this->repoSa = $repoSa;
$this->repoZh = $repoZh;
$this->repo = $repo;
}
......@@ -198,6 +202,7 @@ class MenuController extends Controller
$this->createEn($data, $save);
$this->createDe($data, $save);
$this->createSa($data, $save);
$this->createZh($data, $save);
Alert::success('Data berhasil disimpan')->persistent('Ok');
......@@ -252,6 +257,21 @@ class MenuController extends Controller
$this->repoSa->store($dataSa);
}
private function createZh($data, $menu, $translate = 1)
{
if ($translate == 1) {
$trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETZH, $data['name']);
} else {
$name = $data['name'];
}
$dataZh['menu_id'] = $menu->id;
$dataZh['name'] = $name;
$this->repoSa->store($dataZh);
}
public function storepage(Request $request)
{
$data = $request->except('_token');
......@@ -298,6 +318,9 @@ class MenuController extends Controller
$data['name'] = $page->rSa ? $page->rSa->title : null;
$this->createSa($data, $save, 'notTranslate');
$data['name'] = $page->rZh ? $page->rZh->title : null;
$this->createZh($data, $save, 'notTranslate');
Alert::success('Data berhasil disimpan')->persistent('Ok');
$successmessage = 'Proses Tambah Menu Berhasil !!';
......@@ -326,7 +349,7 @@ class MenuController extends Controller
{
$id = Crypt::decrypt($id);
$setting = webprofilesetting();
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$data = [
'data' => $data,
......@@ -346,7 +369,7 @@ class MenuController extends Controller
$data = $request->except(['_token', 'id']);
$data['name'] = $data['titleiid'];
$menu = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$menu = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$this->repo->update($data, $menu);
if ($menu->rEn) {
......@@ -374,7 +397,7 @@ class MenuController extends Controller
if ($menu->rSa) {
$dataSa['name'] = $data['titleisa'];
$menuSa = $this->repoSa->findId($menu->rSa->id);
$this->repoDe->update($dataSa, $menuSa);
$this->repoSa->update($dataSa, $menuSa);
} else {
$dataSa['menu_id'] = $menu->id;
$dataSa['name'] = $data['titleisa'];
......@@ -382,6 +405,17 @@ class MenuController extends Controller
$this->repoSa->store($dataSa);
}
if ($menu->rZh) {
$dataZh['name'] = $data['titleizh'];
$menuZh = $this->repoSa->findId($menu->rZh->id);
$this->repoZh->update($dataZh, $menuZh);
} else {
$dataZh['menu_id'] = $menu->id;
$dataZh['name'] = $data['titleizh'];
$this->repoZh->store($dataZh);
}
return redirect()->route('menu.index');
}
......
......@@ -8,6 +8,7 @@ use App\Repositories\Webprofile\De\PagesRepository as DePagesRepository;
use App\Repositories\Webprofile\En\PagesRepository as EnPagesRepository;
use App\Repositories\Webprofile\PagesRepository;
use App\Repositories\Webprofile\Sa\PagesRepository as SaPagesRepository;
use App\Repositories\Webprofile\Zh\PagesRepository as ZhPagesRepository;
use Illuminate\Http\Request;
use Statickidz\GoogleTranslate;
......@@ -17,22 +18,26 @@ class PageController extends Controller
private $repoEn;
private $repoDe;
private $repoSa;
private $repoZh;
private $SOURCE = 'id';
private $TARGET = 'en';
private $TARGETDE = 'de';
private $TARGETSA = 'ar';
private $TARGETZH = 'zh';
public function __construct(
PagesRepository $repo,
EnPagesRepository $repoEn,
DePagesRepository $repoDe,
SaPagesRepository $repoSa
SaPagesRepository $repoSa,
ZhPagesRepository $repoZh
) {
$this->repo = $repo;
$this->repoEn = $repoEn;
$this->repoDe = $repoDe;
$this->repoSa = $repoSa;
$this->repoZh = $repoZh;
}
/**
......@@ -85,6 +90,7 @@ class PageController extends Controller
$this->createEn($data, $save);
$this->createDe($data, $save);
$this->createSa($data, $save);
$this->createZh($data, $save);
}
}
......@@ -145,6 +151,24 @@ class PageController extends Controller
$this->repoSa->store($dataSa);
}
private function createZh($data, $page)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETZH, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content']));
$dataZh['page_id'] = $page->id;
$dataZh['title'] = $title;
$dataZh['content'] = $content;
$this->repoZh->store($dataZh);
}
/**
* Display the specified resource.
*
......@@ -165,7 +189,7 @@ class PageController extends Controller
*/
public function edit($id)
{
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$categories = Categories::pluck('name', 'id');
$data = [
......@@ -185,15 +209,16 @@ class PageController extends Controller
*/
public function update(Request $request, $id)
{
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa']);
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa', 'title_zh', 'content_zh']);
$dataEn = $request->except(['_token', 'id']);
$page = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$page = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$edit = $this->repo->update($data, $page);
$this->updateEn($dataEn, $page);
$this->updateDe($dataEn, $page);
$this->updateSa($dataEn, $page);
$this->updateZh($dataEn, $page);
return redirect()->route('pages.index');
}
......@@ -222,6 +247,14 @@ class PageController extends Controller
$this->repoSa->update($dataSa, $page);
}
public function updateZh($data, $page)
{
$dataZh['title'] = $data['title_zh'];
$dataZh['content'] = $data['content_zh'];
$this->repoZh->update($dataZh, $page);
}
/**
* Remove the specified resource from storage.
*
......@@ -246,6 +279,10 @@ class PageController extends Controller
$this->repoSa->destroy($data->rSa);
}
if ($data->rZh) {
$this->repoZh->destroy($data->rZh);
}
return response()->json(['done']);
}
}
......@@ -10,6 +10,7 @@ use App\Repositories\Webprofile\En\PostRepository as EnPostRepository;
use App\Repositories\Webprofile\PostRepository;
use App\Repositories\Webprofile\Sa\PostRepository as SaPostRepository;
use App\Repositories\Webprofile\SocialSharingRepository;
use App\Repositories\Webprofile\Zh\PostRepository as ZhPostRepository;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Config;
......@@ -22,17 +23,20 @@ class PostController extends Controller
private $repoEn;
private $repoDe;
private $repoSa;
private $repoZh;
private $SOURCE = 'id';
private $TARGET = 'en';
private $TARGETDE = 'de';
private $TARGETSA = 'ar';
private $TARGETZH = 'zh';
public function __construct(
PostRepository $repo,
EnPostRepository $repoEn,
DePostRepository $repoDe,
SaPostRepository $repoSa,
ZhPostRepository $repoZh,
SocialSharingRepository $socialRepo,
AutopostRepository $autoPostRepo
) {
......@@ -42,6 +46,7 @@ class PostController extends Controller
$this->autoPostRepo = $autoPostRepo;
$this->repoDe = $repoDe;
$this->repoSa = $repoSa;
$this->repoZh = $repoZh;
}
/**
......@@ -105,6 +110,7 @@ class PostController extends Controller
$this->createEn($data, $save);
$this->createDe($data, $save);
$this->createSa($data, $save);
$this->createZh($data, $save);
}
}
......@@ -230,6 +236,24 @@ class PostController extends Controller
$this->repoSa->store($dataSa);
}
private function createZh($data, $post)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETZH, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content']));
$dataZh['post_id'] = $post->id;
$dataZh['title'] = $title;
$dataZh['content'] = $content;
$this->repoZh->store($dataZh);
}
/**
* Display the specified resource.
*
......@@ -251,7 +275,7 @@ class PostController extends Controller
public function edit($id)
{
$setting = webprofilesetting();
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$categories = Categories::pluck('name', 'id');
$data = [
......@@ -272,14 +296,14 @@ class PostController extends Controller
*/
public function update(Request $request, $id)
{
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa']);
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa', 'title_zh', 'content_zh']);
$dataEn = $request->except(['_token', 'id']);
array_key_exists('post_status', $data) ? $data['post_status'] = 1 : $data['post_status'] = 0;
array_key_exists('cover_status', $data) ? $data['cover_status'] = 1 : $data['cover_status'] = 0;
$data['slug'] = Str::slug($request->input('title'));
$post = $this->repo->findId($id, ['rEn']);
$post = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$edit = $this->repo->update($data, $post);
$tipe = 'thumbnail';
......@@ -293,6 +317,7 @@ class PostController extends Controller
$this->updateEn($dataEn, $post);
$this->updateDe($dataEn, $post);
$this->updateSa($dataEn, $post);
$this->updateZh($dataEn, $post);
return redirect()->route('posts.index');
}
......@@ -321,6 +346,14 @@ class PostController extends Controller
$this->repoSa->update($dataSa, $post);
}
public function updateZh($data, $post)
{
$dataZh['title'] = $data['title_zh'];
$dataZh['content'] = $data['content_zh'];
$this->repoZh->update($dataZh, $post);
}
/**
* Remove the specified resource from storage.
*
......@@ -330,7 +363,7 @@ class PostController extends Controller
*/
public function destroy($id)
{
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa', 'rZh']);
$this->repo->destroy($data, 'thumbnail');
$this->repo->deletefile($data, 'thumbnail');
......@@ -346,6 +379,10 @@ class PostController extends Controller
$this->repoSa->destroy($data->rSa);
}
if ($data->rZh) {
$this->repoZh->destroy($data->rZh);
}
return response()->json(['done']);
}
}
......@@ -6,6 +6,7 @@ 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\Sa\Categories as SaCategories;
use App\Models\Webprofile\Zh\Categories as ZhCategories;
use Illuminate\Database\Eloquent\Model;
class Categories extends Model
......@@ -36,4 +37,9 @@ class Categories extends Model
{
return $this->hasOne(SaCategories::class, 'category_id', 'id');
}
public function rZh()
{
return $this->hasOne(ZhCategories::class, 'category_id', 'id');
}
}
......@@ -6,6 +6,7 @@ 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\Sa\Information as SaInformation;
use App\Models\Webprofile\Zh\Information as ZhInformation;
use Illuminate\Database\Eloquent\Model;
class Information extends Model
......@@ -31,4 +32,9 @@ class Information extends Model
{
return $this->hasOne(SaInformation::class, 'information_id', 'id');
}
public function rZh()
{
return $this->hasOne(ZhInformation::class, 'information_id', 'id');
}
}
......@@ -6,6 +6,7 @@ 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\Sa\Menu as SaMenu;
use App\Models\Webprofile\Zh\Menu as ZhMenu;
use Illuminate\Database\Eloquent\Model;
class Menu extends Model
......@@ -42,6 +43,11 @@ class Menu extends Model
return $this->hasOne(SaMenu::class, 'menu_id', 'id');
}
public function rZh()
{
return $this->hasOne(ZhMenu::class, 'menu_id', 'id');
}
public function rChild()
{
return $this->hasMany(Menu::class, 'parent', 'id')->orderBy('urutan', 'asc')->with(['rChild', 'rEn']);
......
......@@ -6,6 +6,7 @@ use App\Http\Traits\UuidTrait;
use App\Models\Webprofile\De\Pages as DePages;
use App\Models\Webprofile\En\Pages as EnPages;
use App\Models\Webprofile\Sa\Pages as SaPages;
use App\Models\Webprofile\Zh\Pages as ZhPages;
use Illuminate\Database\Eloquent\Model;
class Pages extends Model
......@@ -31,4 +32,9 @@ class Pages extends Model
{
return $this->hasOne(SaPages::class, 'page_id', 'id');
}
public function rZh()
{
return $this->hasOne(ZhPages::class, 'page_id', 'id');
}
}
......@@ -6,6 +6,7 @@ use App\Http\Traits\UuidTrait;
use App\Models\Webprofile\De\Posts as DePosts;
use App\Models\Webprofile\En\Posts as EnPosts;
use App\Models\Webprofile\Sa\Posts as SaPosts;
use App\Models\Webprofile\Zh\Posts as ZhPosts;
use Illuminate\Database\Eloquent\Model;
class Posts extends Model
......@@ -36,4 +37,9 @@ class Posts extends Model
{
return $this->hasOne(SaPosts::class, 'post_id', 'id');
}
public function rZh()
{
return $this->hasOne(ZhPosts::class, 'post_id', 'id');
}
}
<?php
namespace App\Models\Webprofile\Zh;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Categories extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_categories_zh';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\Zh;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Information extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_informations_zh';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\Zh;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Menu extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_menus_zh';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\Zh;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Pages extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_pages_zh';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\Zh;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Posts extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_posts_zh';
protected $guarded = [];
}
<?php
namespace App\Repositories\Webprofile\Zh;
use App\Models\Webprofile\Zh\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\Zh;
use App\Models\Webprofile\Zh\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\Zh;
use App\Models\Webprofile\Zh\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\Zh;
use App\Models\Webprofile\Zh\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\Zh;
use App\Models\Webprofile\Zh\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 CreateZhTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('swp_categories_zh', 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_zh', 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_zh', 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_zh', 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_zh', 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_zh');
Schema::dropIfExists('swp_posts_zh');
Schema::dropIfExists('swp_informations_zh');
Schema::dropIfExists('swp_menus_zh');
Schema::dropIfExists('swp_pages_zh');
}
}
......@@ -79,6 +79,21 @@
</div>
</div>
</div>
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
类别
</div>
<div class="col-md-12">
<div class="form-group @if ($errors->has('name_zh')) has-error @endif">
<label class="col-md-2 control-label">类别</label>
<div class="col-md-10">
{{ Form::text('name_zh', $data->rZh ? $data->rZh->name : null, array('class' => 'form-control', 'required')) }}
@if ($errors->has('name_zh'))
<label id="login-error" class="error" for="login">{{$errors->first('name_zh')}}</label>
@endif
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group" style="padding-top: 10px;">
......
......@@ -54,6 +54,7 @@
<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>
<li class=""><a href="#arab" role="tab" data-toggle="tab" aria-expanded="false">Arab</a></li>
<li class=""><a href="#cina" role="tab" data-toggle="tab" aria-expanded="false">Cina</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="inggris">
......@@ -116,6 +117,26 @@
</div>
</div>
</div>
<div class="tab-pane" id="cina">
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
中文
</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_zh', $data->rZh ? $data->rZh->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_zh', $data->rZh ? $data->rZh->content : null, array('id'=>'content_zh')) }}
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -229,6 +250,10 @@
$('#content_sa').summernote({
height: 350
});
$('#content_zh').summernote({
height: 350
});
});
</script>
@stop
......@@ -54,6 +54,7 @@
<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>
<li class=""><a href="#arab" role="tab" data-toggle="tab" aria-expanded="false">Arab</a></li>
<li class=""><a href="#cina" role="tab" data-toggle="tab" aria-expanded="false">Cina</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="inggris">
......@@ -116,6 +117,26 @@
</div>
</div>
</div>
<div class="tab-pane" id="cina">
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
中文
</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_zh', $data->rZh ? $data->rZh->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_zh', $data->rZh ? $data->rZh->content : null, array('id'=>'content_zh')) }}
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -191,6 +212,9 @@
$('#content_sa').summernote({
height: 350
});
$('#content_zh').summernote({
height: 350
});
});
$('#categories').select2();
......
......@@ -64,6 +64,7 @@
<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>
<li class=""><a href="#arab" role="tab" data-toggle="tab" aria-expanded="false">Arab</a></li>
<li class=""><a href="#cina" role="tab" data-toggle="tab" aria-expanded="false">Cina</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="inggris">
......@@ -126,6 +127,26 @@
</div>
</div>
</div>
<div class="tab-pane" id="cina">
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
中文
</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_zh', $data->rZh ? $data->rZh->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_zh', $data->rZh ? $data->rZh->content : null, array('id'=>'content_zh')) }}
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -288,6 +309,10 @@
$('#content_sa').summernote({
height: 350
});
$('#content_zh').summernote({
height: 350
});
});
$('#categories').select2();
......
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