Commit 9f66ba1f by Aan Choesni Herlingga

backend bahasa arab

parent a38b5467
......@@ -6,6 +6,7 @@ use App\Http\Controllers\Controller;
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 Illuminate\Http\Request;
use Statickidz\GoogleTranslate;
......@@ -14,19 +15,23 @@ class CategoryController extends Controller
private $repo;
private $repoEn;
private $repoDe;
private $repoSa;
private $SOURCE = 'id';
private $TARGET = 'en';
private $TARGETDE = 'de';
private $TARGETSA = 'ar';
public function __construct(
CategoryRepository $repo,
EnCategoryRepository $repoEn,
DeCategoryRepository $repoDe
DeCategoryRepository $repoDe,
SaCategoryRepository $repoSa
) {
$this->repo = $repo;
$this->repoEn = $repoEn;
$this->repoDe = $repoDe;
$this->repoSa = $repoSa;
}
/**
......@@ -70,6 +75,7 @@ class CategoryController extends Controller
$this->createEn($data, $category);
$this->createDe($data, $category);
$this->createSa($data, $category);
return redirect()->route('category.index');
}
......@@ -96,6 +102,17 @@ class CategoryController extends Controller
$this->repoDe->store($dataDe);
}
private function createSa($data, $category)
{
$trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETSA, $data['name']);
$dataSa['category_id'] = $category->id;
$dataSa['name'] = $name;
$this->repoSa->store($dataSa);
}
/**
* Display the specified resource.
*
......@@ -116,7 +133,7 @@ class CategoryController extends Controller
*/
public function edit($id)
{
$data = $this->repo->findId($id, ['rEn', 'rDe']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$data = [
'data' => $data,
......@@ -134,7 +151,7 @@ class CategoryController extends Controller
*/
public function update(Request $request, $id)
{
$data = $request->except(['_token', 'id', 'name_en', 'name_de']);
$data = $request->except(['_token', 'id', 'name_en', 'name_de', 'name_sa']);
$dataEn = $request->except(['_token', 'id', 'name_de']);
$dataDe = $request->except(['_token', 'id', 'name', 'name_en']);
......@@ -145,6 +162,7 @@ class CategoryController extends Controller
$this->updateEn($dataEn, $category);
$this->updateDe($dataDe, $category);
$this->updateSa($dataEn, $category);
return redirect()->route('category.index');
}
......@@ -153,14 +171,42 @@ class CategoryController extends Controller
{
$dataEn['name'] = $data['name_en'];
$this->repoEn->update($dataEn, $category->rEn);
if ($category->rEn) {
$this->repoDe->update($dataEn, $category->rEn);
} else {
$dataEn['category_id'] = $category->id;
$dataEn['name'] = $data['name_en'];
$this->repoEn->store($dataEn);
}
}
public function updateDe($data, $category)
{
$dataDe['name'] = $data['name_de'];
$this->repoEn->update($dataDe, $category->rDe);
if ($category->rDe) {
$this->repoDe->update($dataDe, $category->rDe);
} else {
$dataDe['category_id'] = $category->id;
$dataDe['name'] = $data['name_de'];
$this->repoDe->store($dataDe);
}
}
public function updateSa($data, $category)
{
$dataSa['name'] = $data['name_sa'];
if ($category->rSa) {
$this->repoSa->update($dataSa, $category->rSa);
} else {
$dataSa['category_id'] = $category->id;
$dataSa['name'] = $data['name_sa'];
$this->repoSa->store($dataSa);
}
}
/**
......@@ -173,13 +219,20 @@ class CategoryController extends Controller
public function destroy($id)
{
$data = $this->repo->findId($id, ['rEn', 'berita']);
if (!$data->berita) {
if (count($data->berita) <= 0) {
$this->repo->destroy($data);
if ($data->rEn) {
$this->repoEn->destroy($data->rEn);
}
if ($data->rDe) {
$this->repoDe->destroy($data->rDe);
}
if ($data->rSa) {
$this->repoSa->destroy($data->rSa);
}
}
return response()->json(['done']);
......
......@@ -7,6 +7,7 @@ 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\InformationRepository;
use App\Repositories\Webprofile\Sa\InformationRepository as SaInformationRepository;
use Illuminate\Http\Request;
use Statickidz\GoogleTranslate;
......@@ -15,19 +16,23 @@ class InformationController extends Controller
private $repo;
private $repoEn;
private $repoDe;
private $repoSa;
private $SOURCE = 'id';
private $TARGET = 'en';
private $TARGETDE = 'de';
private $TARGETSA = 'ar';
public function __construct(
InformationRepository $repo,
EnInformationRepository $repoEn,
DeInformationRepository $repoDe
DeInformationRepository $repoDe,
SaInformationRepository $repoSa
) {
$this->repo = $repo;
$this->repoEn = $repoEn;
$this->repoDe = $repoDe;
$this->repoSa = $repoSa;
}
/**
......@@ -80,6 +85,7 @@ class InformationController extends Controller
// save translate
$this->createEn($data, $save);
$this->createDe($data, $save);
$this->createSa($data, $save);
}
return redirect()->route('informations.index');
......@@ -121,6 +127,24 @@ class InformationController extends Controller
$this->repoDe->store($dataDe);
}
private function createSa($data, $information)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETSA, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content']));
$dataSa['information_id'] = $information->id;
$dataSa['title'] = $title;
$dataSa['content'] = $content;
$this->repoSa->store($dataSa);
}
/**
* Display the specified resource.
*
......@@ -141,7 +165,7 @@ class InformationController extends Controller
*/
public function edit($id)
{
$data = $this->repo->findId($id);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$categories = Categories::pluck('name', 'id');
$data = [
......@@ -161,17 +185,18 @@ class InformationController extends Controller
*/
public function update(Request $request, $id)
{
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de']);
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa']);
$dataEn = $request->except(['_token', 'id']);
array_key_exists('info_status', $data) ? $data['info_status'] = 1 : $data['info_status'] = 0;
$data['slug'] = str_slug($request->input('title'));
$information = $this->repo->findId($id, ['rEn', 'rDe']);
$information = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$edit = $this->repo->update($data, $information);
$this->updateEn($dataEn, $information);
$this->updateDe($dataEn, $information);
$this->updateSa($dataEn, $information);
return redirect()->route('informations.index');
}
......@@ -192,6 +217,14 @@ class InformationController extends Controller
$this->repoDe->update($dataDe, $information);
}
public function updateSa($data, $information)
{
$dataSa['title'] = $data['title_sa'];
$dataSa['content'] = $data['content_sa'];
$this->repoSa->update($dataSa, $information);
}
/**
* Remove the specified resource from storage.
*
......@@ -201,13 +234,21 @@ class InformationController extends Controller
*/
public function destroy($id)
{
$data = $this->repo->findId($id, ['rEn']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$this->repo->destroy($data);
if ($data->rEn) {
$this->repoEn->destroy($data->rEn);
}
if ($data->rDe) {
$this->repoDe->destroy($data->rDe);
}
if ($data->rSa) {
$this->repoSa->destroy($data->rSa);
}
return response()->json(['done']);
}
}
......@@ -9,6 +9,7 @@ use App\Models\Webprofile\Pages;
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 Auth;
use Crypt;
use Illuminate\Http\Request;
......@@ -20,14 +21,17 @@ class MenuController extends Controller
private $SOURCE = 'id';
private $TARGET = 'en';
private $TARGETDE = 'de';
private $TARGETSA = 'ar';
public function __construct(
MenuRepository $repoEn,
WebprofileMenuRepository $repo,
DeMenuRepository $repoDe
DeMenuRepository $repoDe,
SaMenuRepository $repoSa
) {
$this->repoEn = $repoEn;
$this->repoDe = $repoDe;
$this->repoSa = $repoSa;
$this->repo = $repo;
}
......@@ -193,6 +197,7 @@ class MenuController extends Controller
$this->createEn($data, $save);
$this->createDe($data, $save);
$this->createSa($data, $save);
Alert::success('Data berhasil disimpan')->persistent('Ok');
......@@ -232,6 +237,21 @@ class MenuController extends Controller
$this->repoDe->store($dataDe);
}
private function createSa($data, $menu, $translate = 1)
{
if ($translate == 1) {
$trans = new GoogleTranslate();
$name = $trans->translate($this->SOURCE, $this->TARGETSA, $data['name']);
} else {
$name = $data['name'];
}
$dataSa['menu_id'] = $menu->id;
$dataSa['name'] = $name;
$this->repoSa->store($dataSa);
}
public function storepage(Request $request)
{
$data = $request->except('_token');
......@@ -269,11 +289,15 @@ class MenuController extends Controller
$save = Menu::create($data);
$data['name'] = $page->rEn->title;
$data['name'] = $page->rEn ? $page->rEn->title : null;
$this->createEn($data, $save, 'notTranslate');
$data['name'] = $page->rDe ? $page->rDe->title : null;
$this->createDe($data, $save, 'notTranslate');
$data['name'] = $page->rSa ? $page->rSa->title : null;
$this->createSa($data, $save, 'notTranslate');
Alert::success('Data berhasil disimpan')->persistent('Ok');
$successmessage = 'Proses Tambah Menu Berhasil !!';
......@@ -302,7 +326,7 @@ class MenuController extends Controller
{
$id = Crypt::decrypt($id);
$setting = webprofilesetting();
$data = $this->repo->findId($id, ['rEn', 'rDe']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$data = [
'data' => $data,
......@@ -322,16 +346,41 @@ class MenuController extends Controller
$data = $request->except(['_token', 'id']);
$data['name'] = $data['titleiid'];
$menu = $this->repo->findId($id, ['rEn', 'rDe']);
$menu = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$this->repo->update($data, $menu);
$dataEn['name'] = $data['titleien'];
$menuEn = $this->repoEn->findId($menu->rEn->id);
$this->repoEn->update($dataEn, $menuEn);
if ($menu->rEn) {
$dataEn['name'] = $data['titleien'];
$menuEn = $this->repoEn->findId($menu->rEn->id);
$this->repoEn->update($dataEn, $menuEn);
} else {
$dataEn['menu_id'] = $menu->id;
$dataEn['name'] = $data['titleien'];
$this->repoEn->store($dataEn);
}
if ($menu->rDe) {
$dataDe['name'] = $data['titleide'];
$menuDe = $this->repoDe->findId($menu->rDe->id);
$this->repoDe->update($dataDe, $menuDe);
} else {
$dataDe['menu_id'] = $menu->id;
$dataDe['name'] = $data['titleide'];
$dataDe['name'] = $data['titleide'];
$menuDe = $this->repoDe->findId($menu->rDe->id);
$this->repoDe->update($dataDe, $menuDe);
$this->repoDe->store($dataDe);
}
if ($menu->rSa) {
$dataSa['name'] = $data['titleisa'];
$menuSa = $this->repoSa->findId($menu->rSa->id);
$this->repoDe->update($dataSa, $menuSa);
} else {
$dataSa['menu_id'] = $menu->id;
$dataSa['name'] = $data['titleisa'];
$this->repoSa->store($dataSa);
}
return redirect()->route('menu.index');
}
......
......@@ -7,6 +7,7 @@ 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\PagesRepository;
use App\Repositories\Webprofile\Sa\PagesRepository as SaPagesRepository;
use Illuminate\Http\Request;
use Statickidz\GoogleTranslate;
......@@ -15,19 +16,23 @@ class PageController extends Controller
private $repo;
private $repoEn;
private $repoDe;
private $repoSa;
private $SOURCE = 'id';
private $TARGET = 'en';
private $TARGETDE = 'de';
private $TARGETSA = 'ar';
public function __construct(
PagesRepository $repo,
EnPagesRepository $repoEn,
DePagesRepository $repoDe
DePagesRepository $repoDe,
SaPagesRepository $repoSa
) {
$this->repo = $repo;
$this->repoEn = $repoEn;
$this->repoDe = $repoDe;
$this->repoSa = $repoSa;
}
/**
......@@ -79,6 +84,7 @@ class PageController extends Controller
if (strlen($data['content']) < 5000) {
$this->createEn($data, $save);
$this->createDe($data, $save);
$this->createSa($data, $save);
}
}
......@@ -121,6 +127,24 @@ class PageController extends Controller
$this->repoDe->store($dataDe);
}
private function createSa($data, $page)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETSA, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content']));
$dataSa['page_id'] = $page->id;
$dataSa['title'] = $title;
$dataSa['content'] = $content;
$this->repoSa->store($dataSa);
}
/**
* Display the specified resource.
*
......@@ -141,7 +165,7 @@ class PageController extends Controller
*/
public function edit($id)
{
$data = $this->repo->findId($id);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$categories = Categories::pluck('name', 'id');
$data = [
......@@ -161,14 +185,15 @@ class PageController extends Controller
*/
public function update(Request $request, $id)
{
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de']);
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa']);
$dataEn = $request->except(['_token', 'id']);
$page = $this->repo->findId($id, ['rEn', 'rDe']);
$page = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$edit = $this->repo->update($data, $page);
$this->updateEn($dataEn, $page);
$this->updateDe($dataEn, $page);
$this->updateSa($dataEn, $page);
return redirect()->route('pages.index');
}
......@@ -189,6 +214,14 @@ class PageController extends Controller
$this->repoDe->update($dataDe, $page);
}
public function updateSa($data, $page)
{
$dataSa['title'] = $data['title_sa'];
$dataSa['content'] = $data['content_sa'];
$this->repoSa->update($dataSa, $page);
}
/**
* Remove the specified resource from storage.
*
......@@ -198,13 +231,21 @@ class PageController extends Controller
*/
public function destroy($id)
{
$data = $this->repo->findId($id, ['rEn']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$this->repo->destroy($data);
if ($data->rEn) {
$this->repoEn->destroy($data->rEn);
}
if ($data->rDe) {
$this->repoDe->destroy($data->rDe);
}
if ($data->rSa) {
$this->repoSa->destroy($data->rSa);
}
return response()->json(['done']);
}
}
......@@ -8,6 +8,7 @@ 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\PostRepository;
use App\Repositories\Webprofile\Sa\PostRepository as SaPostRepository;
use App\Repositories\Webprofile\SocialSharingRepository;
use GuzzleHttp\Client;
use Illuminate\Http\Request;
......@@ -20,15 +21,18 @@ class PostController extends Controller
private $repo;
private $repoEn;
private $repoDe;
private $repoSa;
private $SOURCE = 'id';
private $TARGET = 'en';
private $TARGETDE = 'de';
private $TARGETSA = 'ar';
public function __construct(
PostRepository $repo,
EnPostRepository $repoEn,
DePostRepository $repoDe,
SaPostRepository $repoSa,
SocialSharingRepository $socialRepo,
AutopostRepository $autoPostRepo
) {
......@@ -37,6 +41,7 @@ class PostController extends Controller
$this->socialRepo = $socialRepo;
$this->autoPostRepo = $autoPostRepo;
$this->repoDe = $repoDe;
$this->repoSa = $repoSa;
}
/**
......@@ -99,6 +104,7 @@ class PostController extends Controller
if (strlen($data['content']) < 5000) {
$this->createEn($data, $save);
$this->createDe($data, $save);
$this->createSa($data, $save);
}
}
......@@ -206,6 +212,24 @@ class PostController extends Controller
$this->repoDe->store($dataDe);
}
private function createSa($data, $post)
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETSA, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content']));
$dataSa['post_id'] = $post->id;
$dataSa['title'] = $title;
$dataSa['content'] = $content;
$this->repoSa->store($dataSa);
}
/**
* Display the specified resource.
*
......@@ -227,7 +251,7 @@ class PostController extends Controller
public function edit($id)
{
$setting = webprofilesetting();
$data = $this->repo->findId($id, ['rEn']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$categories = Categories::pluck('name', 'id');
$data = [
......@@ -248,7 +272,7 @@ class PostController extends Controller
*/
public function update(Request $request, $id)
{
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de']);
$data = $request->except(['_token', 'id', 'title_en', 'content_en', 'title_de', 'content_de', 'title_sa', 'content_sa']);
$dataEn = $request->except(['_token', 'id']);
array_key_exists('post_status', $data) ? $data['post_status'] = 1 : $data['post_status'] = 0;
......@@ -268,6 +292,7 @@ class PostController extends Controller
$this->updateEn($dataEn, $post);
$this->updateDe($dataEn, $post);
$this->updateSa($dataEn, $post);
return redirect()->route('posts.index');
}
......@@ -288,6 +313,14 @@ class PostController extends Controller
$this->repoDe->update($dataDe, $post);
}
public function updateSa($data, $post)
{
$dataSa['title'] = $data['title_sa'];
$dataSa['content'] = $data['content_sa'];
$this->repoSa->update($dataSa, $post);
}
/**
* Remove the specified resource from storage.
*
......@@ -297,7 +330,7 @@ class PostController extends Controller
*/
public function destroy($id)
{
$data = $this->repo->findId($id, ['rEn']);
$data = $this->repo->findId($id, ['rEn', 'rDe', 'rSa']);
$this->repo->destroy($data, 'thumbnail');
$this->repo->deletefile($data, 'thumbnail');
......@@ -305,6 +338,14 @@ class PostController extends Controller
$this->repoEn->destroy($data->rEn);
}
if ($data->rDe) {
$this->repoDe->destroy($data->rDe);
}
if ($data->rSa) {
$this->repoSa->destroy($data->rSa);
}
return response()->json(['done']);
}
}
......@@ -5,6 +5,7 @@ namespace App\Models\Webprofile;
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 Illuminate\Database\Eloquent\Model;
class Categories extends Model
......@@ -30,4 +31,9 @@ class Categories extends Model
{
return $this->hasOne(DeCategories::class, 'category_id', 'id');
}
public function rSa()
{
return $this->hasOne(SaCategories::class, 'category_id', 'id');
}
}
......@@ -5,6 +5,7 @@ namespace App\Models\Webprofile;
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 Illuminate\Database\Eloquent\Model;
class Information extends Model
......@@ -25,4 +26,9 @@ class Information extends Model
{
return $this->hasOne(DeInformation::class, 'information_id', 'id');
}
public function rSa()
{
return $this->hasOne(SaInformation::class, 'information_id', 'id');
}
}
......@@ -5,6 +5,7 @@ namespace App\Models\Webprofile;
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 Illuminate\Database\Eloquent\Model;
class Menu extends Model
......@@ -36,6 +37,11 @@ class Menu extends Model
return $this->hasOne(DeMenu::class, 'menu_id', 'id');
}
public function rSa()
{
return $this->hasOne(SaMenu::class, 'menu_id', 'id');
}
public function rChild()
{
return $this->hasMany(Menu::class, 'parent', 'id')->orderBy('urutan', 'asc')->with(['rChild', 'rEn']);
......
......@@ -5,6 +5,7 @@ namespace App\Models\Webprofile;
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 Illuminate\Database\Eloquent\Model;
class Pages extends Model
......@@ -25,4 +26,9 @@ class Pages extends Model
{
return $this->hasOne(DePages::class, 'page_id', 'id');
}
public function rSa()
{
return $this->hasOne(SaPages::class, 'page_id', 'id');
}
}
......@@ -5,6 +5,7 @@ namespace App\Models\Webprofile;
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 Illuminate\Database\Eloquent\Model;
class Posts extends Model
......@@ -30,4 +31,9 @@ class Posts extends Model
{
return $this->hasOne(DePosts::class, 'post_id', 'id');
}
public function rSa()
{
return $this->hasOne(SaPosts::class, 'post_id', 'id');
}
}
<?php
namespace App\Models\Webprofile\Sa;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Categories extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_categories_sa';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\Sa;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Information extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_informations_sa';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\Sa;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Menu extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_menus_sa';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\Sa;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Pages extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_pages_sa';
protected $guarded = [];
}
<?php
namespace App\Models\Webprofile\Sa;
use App\Http\Traits\UuidTrait;
use Illuminate\Database\Eloquent\Model;
class Posts extends Model
{
use UuidTrait;
public $incrementing = false;
protected $table = 'swp_posts_sa';
protected $guarded = [];
}
<?php
namespace App\Repositories\Webprofile\Sa;
use App\Models\Webprofile\Sa\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\Sa;
use App\Models\Webprofile\Sa\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\Sa;
use App\Models\Webprofile\Sa\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\Sa;
use App\Models\Webprofile\Sa\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\Sa;
use App\Models\Webprofile\Sa\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 CreateSaTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('swp_categories_sa', 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_sa', 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_sa', 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_sa', 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_sa', 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_sa');
Schema::dropIfExists('swp_posts_sa');
Schema::dropIfExists('swp_informations_sa');
Schema::dropIfExists('swp_menus_sa');
Schema::dropIfExists('swp_pages_sa');
}
}
......@@ -49,6 +49,7 @@
</div>
</div>
</div>
<div style="padding: 10px 10px 10px 10px; font-weight: bold; font-size: 14pt;">
deutsche Sprache
</div>
......@@ -56,13 +57,29 @@
<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')) }}
{{ Form::text('name_de', $data->rDe ? $data->rDe->name : null, 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 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_sa')) has-error @endif">
<label class="col-md-2 control-label">الفئة</label>
<div class="col-md-10">
{{ Form::text('name_sa', $data->rSa ? $data->rSa->name : null, array('class' => 'form-control', 'required')) }}
@if ($errors->has('name_sa'))
<label id="login-error" class="error" for="login">{{$errors->first('name_sa')}}</label>
@endif
</div>
</div>
</div>
<div class="col-md-12">
<div class="form-group" style="padding-top: 10px;">
<label class="col-md-2 control-label">Status</label>
......
......@@ -53,6 +53,7 @@
<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>
<li class=""><a href="#arab" role="tab" data-toggle="tab" aria-expanded="false">Arab</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="inggris">
......@@ -95,6 +96,26 @@
</div>
</div>
</div>
<div class="tab-pane" id="arab">
<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_sa', $data->rSa ? $data->rSa->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_sa', $data->rSa ? $data->rSa->content : null, array('id'=>'content_sa')) }}
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -205,6 +226,9 @@
$('#content_de').summernote({
height: 350
});
$('#content_sa').summernote({
height: 350
});
});
</script>
@stop
......@@ -34,7 +34,7 @@
<div class="form-group @if ($errors->has('titleien')) has-error @endif">
<label class="col-md-2 control-label">@lang('feature.menuen')</label>
<div class="col-md-10">
{{ Form::text('titleien', $data->rEn->name, array('class' => 'form-control', 'required')) }}
{{ Form::text('titleien', $data->rEn ? $data->rEn->name : null, array('class' => 'form-control', 'required')) }}
@if ($errors->has('titleien'))
<label id="login-error" class="error" for="login">{{$errors->first('titleien')}}</label>
@endif
......@@ -43,12 +43,21 @@
<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')) }}
{{ Form::text('titleide', $data->rDe ? $data->rDe->name : null, 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('titleisa')) has-error @endif">
<label class="col-md-2 control-label">Arab Title</label>
<div class="col-md-10">
{{ Form::text('titleisa', $data->rSa ? $data->rSa->name : null, array('class' => 'form-control', 'required')) }}
@if ($errors->has('titleisa'))
<label id="login-error" class="error" for="login">{{$errors->first('titleisa')}}</label>
@endif
</div>
</div>
<div class="form-group @if ($errors->has('url')) has-error @endif">
<label class="col-md-2 control-label">URL</label>
<div class="col-md-10">
......
......@@ -53,6 +53,7 @@
<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>
<li class=""><a href="#arab" role="tab" data-toggle="tab" aria-expanded="false">Arab</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="inggris">
......@@ -95,6 +96,26 @@
</div>
</div>
</div>
<div class="tab-pane" id="arab">
<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_sa', $data->rSa ? $data->rSa->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_sa', $data->rSa ? $data->rSa->content : null, array('id'=>'content_sa')) }}
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -167,6 +188,9 @@
$('#content_de').summernote({
height: 350
});
$('#content_sa').summernote({
height: 350
});
});
$('#categories').select2();
......
......@@ -63,6 +63,7 @@
<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>
<li class=""><a href="#arab" role="tab" data-toggle="tab" aria-expanded="false">Arab</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="inggris">
......@@ -105,6 +106,26 @@
</div>
</div>
</div>
<div class="tab-pane" id="arab">
<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_sa', $data->rSa ? $data->rSa->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_sa', $data->rSa ? $data->rSa->content : null, array('id'=>'content_sa')) }}
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -263,6 +284,10 @@
$('#content_de').summernote({
height: 350
});
$('#content_sa').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