Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webprofile-jwg2024
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Siti Aisah
webprofile-jwg2024
Commits
02068910
Commit
02068910
authored
5 years ago
by
Aan Choesni Herlingga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
translate menu en
parent
ac673cec
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
6 deletions
+59
-6
app/Http/Controllers/Webprofile/Backend/MenuController.php
+16
-6
app/Models/Webprofile/En/Menu.php
+16
-0
app/Models/Webprofile/Menu.php
+6
-0
app/Repositories/Webprofile/En/MenuRepository.php
+21
-0
No files found.
app/Http/Controllers/Webprofile/Backend/MenuController.php
View file @
02068910
...
...
@@ -9,6 +9,7 @@ use App\Models\Webprofile\Menu;
use
Validator
;
use
Uuid
;
use
Alert
;
use
App\Repositories\Webprofile\En\MenuRepository
;
use
Crypt
;
use
Auth
;
use
Statickidz\GoogleTranslate
;
...
...
@@ -17,7 +18,12 @@ class MenuController extends Controller
{
private
$SOURCE
=
'id'
;
private
$TARGET
=
'en'
;
public
function
__construct
(
MenuRepository
$repoEn
)
{
$this
->
repoEn
=
$repoEn
;
}
/**
* Display a listing of the resource.
*
...
...
@@ -27,7 +33,7 @@ class MenuController extends Controller
{
$parent
=
Menu
::
where
(
'status'
,
'1'
)
->
whereNull
(
'url'
)
->
whereIn
(
'level'
,
[
1
,
2
])
->
pluck
(
'name'
,
'id'
);
$page
=
Pages
::
where
(
'post_status'
,
'1'
)
->
pluck
(
'title'
,
'id'
);
$data
=
Menu
::
select
(
'id'
,
'parent'
,
'name'
,
'url'
,
'level'
,
'urutan'
)
->
orderby
(
'level'
,
'asc'
)
->
orderby
(
'urutan'
,
'asc'
)
->
get
();
$data
=
Menu
::
with
([
'rEn'
])
->
select
(
'id'
,
'parent'
,
'name'
,
'url'
,
'level'
,
'urutan'
)
->
orderby
(
'level'
,
'asc'
)
->
orderby
(
'urutan'
,
'asc'
)
->
get
();
$arr
=
$this
->
build_menu
();
...
...
@@ -184,7 +190,9 @@ class MenuController extends Controller
$data
[
'userid_created'
]
=
Auth
::
user
()
->
name
;
$data
[
'userid_updated'
]
=
Auth
::
user
()
->
name
;
Menu
::
create
(
$data
);
$save
=
Menu
::
create
(
$data
);
$this
->
createEn
(
$data
,
$save
);
Alert
::
success
(
'Data berhasil disimpan'
)
->
persistent
(
'Ok'
);
...
...
@@ -193,12 +201,12 @@ class MenuController extends Controller
}
}
private
function
createEn
(
$data
,
$
category
)
private
function
createEn
(
$data
,
$
menu
)
{
$trans
=
new
GoogleTranslate
();
$name
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
$data
[
'name'
]);
$dataEn
[
'
category_id'
]
=
$category
->
id
;
$dataEn
[
'
menu_id'
]
=
$menu
->
id
;
$dataEn
[
'name'
]
=
$name
;
$this
->
repoEn
->
store
(
$dataEn
);
...
...
@@ -238,7 +246,9 @@ class MenuController extends Controller
$data
[
'userid_created'
]
=
Auth
::
user
()
->
name
;
$data
[
'userid_updated'
]
=
Auth
::
user
()
->
name
;
Menu
::
create
(
$data
);
$save
=
Menu
::
create
(
$data
);
$this
->
createEn
(
$data
,
$save
);
Alert
::
success
(
'Data berhasil disimpan'
)
->
persistent
(
'Ok'
);
...
...
This diff is collapsed.
Click to expand it.
app/Models/Webprofile/En/Menu.php
0 → 100644
View file @
02068910
<?php
namespace
App\Models\Webprofile\En
;
use
App\Http\Traits\UuidTrait
;
use
Illuminate\Database\Eloquent\Model
;
class
Menu
extends
Model
{
use
UuidTrait
;
public
$incrementing
=
false
;
protected
$table
=
'swp_menus_en'
;
protected
$guarded
=
[];
}
This diff is collapsed.
Click to expand it.
app/Models/Webprofile/Menu.php
View file @
02068910
...
...
@@ -3,6 +3,7 @@
namespace
App\Models\Webprofile
;
use
App\Http\Traits\UuidTrait
;
use
App\Models\Webprofile\En\Menu
as
EnMenu
;
use
Illuminate\Database\Eloquent\Model
;
class
Menu
extends
Model
...
...
@@ -21,4 +22,9 @@ class Menu extends Model
public
static
$errormessage
=
[
'required'
=>
'Form Input Ini Tidak Boleh Kosong / Harus Diisi'
,
];
public
function
rEn
()
{
return
$this
->
hasOne
(
EnMenu
::
class
,
'menu_id'
,
'id'
);
}
}
This diff is collapsed.
Click to expand it.
app/Repositories/Webprofile/En/MenuRepository.php
0 → 100644
View file @
02068910
<?php
namespace
App\Repositories\Webprofile\En
;
use
App\Models\Webprofile\En\Menu
;
use
App\Repositories\Repository
;
class
MenuRepository
extends
Repository
{
public
function
__construct
(
Menu
$model
)
{
$this
->
model
=
$model
;
}
public
function
get
()
{
}
public
function
paginate
()
{
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment