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
cc6756fb
Commit
cc6756fb
authored
Jul 05, 2022
by
Bagus Pambudi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix update auto translate dan manual
parent
ec13963f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
39 additions
and
16 deletions
+39
-16
app/Http/Controllers/Webprofile/Backend/PostController.php
+36
-15
resources/views/webprofile/backend/posts/edit.blade.php
+2
-1
resources/views/webprofile/backend/posts/edit_per_bahasa.blade.php
+1
-0
No files found.
app/Http/Controllers/Webprofile/Backend/PostController.php
View file @
cc6756fb
...
...
@@ -332,8 +332,8 @@ 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'
,
'title_zh'
,
'content_zh'
]);
$dataEn
=
$request
->
except
([
'_token'
,
'id'
]);
$data
=
$request
->
except
([
'_token'
,
'manual'
,
'id'
,
'title_en'
,
'content_en'
,
'title_de'
,
'content_de'
,
'title_sa'
,
'content_sa'
,
'title_zh'
,
'content_zh'
]);
$dataEn
=
$request
->
except
([
'_token'
,
'id'
,
'manual'
]);
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
;
...
...
@@ -350,21 +350,28 @@ class PostController extends Controller
$this
->
repo
->
update
(
$img
,
$post
);
}
// dd($data);
$this
->
updateEn
(
$dataEn
,
$post
);
$this
->
updateDe
(
$dataEn
,
$post
);
$this
->
updateSa
(
$dataEn
,
$post
);
$this
->
updateZh
(
$dataEn
,
$post
);
$this
->
updateEn
(
$dataEn
,
$post
,
$request
->
manual
);
$this
->
updateDe
(
$dataEn
,
$post
,
$request
->
manual
);
$this
->
updateSa
(
$dataEn
,
$post
,
$request
->
manual
);
$this
->
updateZh
(
$dataEn
,
$post
,
$request
->
manual
);
return
redirect
()
->
route
(
'posts.index'
);
}
public
function
updateEn
(
$data
,
$post
)
public
function
updateEn
(
$data
,
$post
,
$manual
)
{
if
(
$manual
=
1
){
// dd($manual);
if
(
$manual
==
1
){
$dataEn
[
'title'
]
=
$data
[
'title_en'
];
$dataEn
[
'content'
]
=
$data
[
'content_en'
];
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'content'
]));
...
...
@@ -372,17 +379,22 @@ class PostController extends Controller
$dataEn
[
'title'
]
=
$title
;
$dataEn
[
'content'
]
=
$content
;
// dd($dataEn['title']);
}
}
$this
->
repoEn
->
update
(
$dataEn
,
$post
);
}
public
function
updateDe
(
$data
,
$post
)
public
function
updateDe
(
$data
,
$post
,
$manual
)
{
if
(
$manual
=
1
){
if
(
$manual
=
=
1
){
$dataDe
[
'title'
]
=
$data
[
'title_de'
];
$dataDe
[
'content'
]
=
$data
[
'content_de'
];
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
strip_tags
(
$data
[
'content'
]));
...
...
@@ -392,13 +404,18 @@ class PostController extends Controller
$this
->
repoDe
->
update
(
$dataDe
,
$post
);
}
public
function
updateSa
(
$data
,
$post
)
public
function
updateSa
(
$data
,
$post
,
$manual
)
{
if
(
$manual
=
1
){
if
(
$manual
=
=
1
){
$dataSa
[
'title'
]
=
$data
[
'title_sa'
];
$dataSa
[
'content'
]
=
$data
[
'content_sa'
];
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
strip_tags
(
$data
[
'content'
]));
...
...
@@ -408,13 +425,17 @@ class PostController extends Controller
$this
->
repoSa
->
update
(
$dataSa
,
$post
);
}
public
function
updateZh
(
$data
,
$post
)
public
function
updateZh
(
$data
,
$post
,
$manual
)
{
if
(
$manual
=
1
){
if
(
$manual
=
=
1
){
$dataZh
[
'title'
]
=
$data
[
'title_zh'
];
$dataZh
[
'content'
]
=
$data
[
'content_zh'
];
}
else
{
if
(
strip_tags
(
$data
[
'content'
])
==
null
)
{
$data
[
'content'
]
=
'kosong'
;
}
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
strip_tags
(
$data
[
'content'
]));
...
...
resources/views/webprofile/backend/posts/edit.blade.php
View file @
cc6756fb
...
...
@@ -56,7 +56,8 @@
<div class="
col
-
md
-
12
">
<div class="
block
">
{{ Form::textarea('content', null, array('id'=>'content')) }}
</div>
{{ Form::hidden('manual',
$manual
, array('id'=>'manual')) }}
</div>
</div>
</div>
...
...
resources/views/webprofile/backend/posts/edit_per_bahasa.blade.php
View file @
cc6756fb
...
...
@@ -56,6 +56,7 @@
<div class="
col
-
md
-
12
">
<div class="
block
">
{{ Form::textarea('content', null, array('id'=>'content')) }}
{{ Form::hidden('manual',
$manual
, array('id'=>'manual')) }}
</div>
</div>
</div>
...
...
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