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
ec13963f
Commit
ec13963f
authored
Jul 05, 2022
by
Bagus Pambudi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
edit post manual dan auto translate
parent
04aaebc8
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
44 additions
and
4 deletions
+44
-4
app/Http/Controllers/Webprofile/Backend/PostController.php
+42
-3
app/Repositories/Webprofile/PostRepository.php
+1
-1
routes/webprofile/backend.php
+1
-0
No files found.
app/Http/Controllers/Webprofile/Backend/PostController.php
View file @
ec13963f
...
...
@@ -295,15 +295,33 @@ class PostController extends Controller
$setting
=
webprofilesetting
();
$data
=
$this
->
repo
->
findId
(
$id
,
[
'rEn'
,
'rDe'
,
'rSa'
,
'rZh'
]);
$categories
=
Categories
::
pluck
(
'name'
,
'id'
);
$manual
=
0
;
$data
=
[
'data'
=>
$data
,
'categories'
=>
$categories
,
'setting'
=>
$setting
,
'manual'
=>
$manual
,
];
return
view
(
'webprofile.backend.posts.edit'
,
$data
)
->
withTitle
(
trans
(
'feature.edit_post'
));
}
public
function
editPerBahasa
(
$id
)
{
$setting
=
webprofilesetting
();
$data
=
$this
->
repo
->
findId
(
$id
,
[
'rEn'
,
'rDe'
,
'rSa'
,
'rZh'
]);
$categories
=
Categories
::
pluck
(
'name'
,
'id'
);
$manual
=
1
;
$data
=
[
'data'
=>
$data
,
'categories'
=>
$categories
,
'setting'
=>
$setting
,
'manual'
=>
$manual
,
];
return
view
(
'webprofile.backend.posts.edit_per_bahasa'
,
$data
)
->
withTitle
(
trans
(
'feature.edit_post'
));
}
/**
* Update the specified resource in storage.
...
...
@@ -342,6 +360,11 @@ class PostController extends Controller
public
function
updateEn
(
$data
,
$post
)
{
if
(
$manual
=
1
){
$dataEn
[
'title'
]
=
$data
[
'title_en'
];
$dataEn
[
'content'
]
=
$data
[
'content_en'
];
}
else
{
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'content'
]));
...
...
@@ -349,39 +372,55 @@ class PostController extends Controller
$dataEn
[
'title'
]
=
$title
;
$dataEn
[
'content'
]
=
$content
;
// dd($dataEn['title']);
}
$this
->
repoEn
->
update
(
$dataEn
,
$post
);
}
public
function
updateDe
(
$data
,
$post
)
{
if
(
$manual
=
1
){
$dataDe
[
'title'
]
=
$data
[
'title_de'
];
$dataDe
[
'content'
]
=
$data
[
'content_de'
];
}
else
{
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETDE
,
strip_tags
(
$data
[
'content'
]));
$dataDe
[
'title'
]
=
$title
;
$dataDe
[
'content'
]
=
$content
;
}
$this
->
repoDe
->
update
(
$dataDe
,
$post
);
}
public
function
updateSa
(
$data
,
$post
)
{
if
(
$manual
=
1
){
$dataSa
[
'title'
]
=
$data
[
'title_sa'
];
$dataSa
[
'content'
]
=
$data
[
'content_sa'
];
}
else
{
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETSA
,
strip_tags
(
$data
[
'content'
]));
$dataSa
[
'title'
]
=
$title
;
$dataSa
[
'content'
]
=
$content
;
}
$this
->
repoSa
->
update
(
$dataSa
,
$post
);
}
public
function
updateZh
(
$data
,
$post
)
{
if
(
$manual
=
1
){
$dataZh
[
'title'
]
=
$data
[
'title_zh'
];
$dataZh
[
'content'
]
=
$data
[
'content_zh'
];
}
else
{
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
$data
[
'title'
]);
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGETZH
,
strip_tags
(
$data
[
'content'
]));
$dataZh
[
'title'
]
=
$title
;
$dataZh
[
'content'
]
=
$content
;
}
$this
->
repoZh
->
update
(
$dataZh
,
$post
);
}
...
...
app/Repositories/Webprofile/PostRepository.php
View file @
ec13963f
...
...
@@ -37,7 +37,7 @@ class PostRepository extends Repository
->
addColumn
(
'action'
,
function
(
$row
)
{
$btn
=
'<a href="'
.
url
(
'/webprofile/posts/'
.
$row
->
id
.
'/edit'
)
.
'" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.editsemuabahasa'
)
.
'" class="edit btn btn-warning btn-round btn-sm edit">'
.
trans
(
'label.editsemuabahasa'
)
.
'</a>'
;
// $btn = $btn.' <a href="'.url('/webprofile/posts/'.$row->id.'/editPerB
ahasa').'" data-toggle="tooltip" data-id="'.$row->id.'" data-original-title="'.trans('label.edittiapbahasa').'" class="edit btn btn-warning btn-round btn-sm edit">'.trans('label.edittiapbahasa').'</a>';
$btn
=
$btn
.
' <a href="'
.
url
(
'/webprofile/posts/'
.
$row
->
id
.
'/editperb
ahasa'
)
.
'" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.edittiapbahasa'
)
.
'" class="edit btn btn-warning btn-round btn-sm edit">'
.
trans
(
'label.edittiapbahasa'
)
.
'</a>'
;
$btn
=
$btn
.
' <a href="javascript:void(0)" data-toggle="tooltip" data-id="'
.
$row
->
id
.
'" data-original-title="'
.
trans
(
'label.delete'
)
.
'" class="btn btn-danger btn-round btn-sm delete">'
.
trans
(
'label.delete'
)
.
'</a>'
;
...
...
routes/webprofile/backend.php
View file @
ec13963f
...
...
@@ -15,6 +15,7 @@ Route::group(['middleware' => 'auth'], function () {
Route
::
group
([
'middleware'
=>
'role:admin|laman'
],
function
()
{
Route
::
group
([
'namespace'
=>
'Webprofile\Backend'
,
'prefix'
=>
'webprofile'
],
function
()
{
Route
::
resource
(
'category'
,
'CategoryController'
);
Route
::
get
(
'posts/{id}/editperbahasa'
,
'PostController@editperbahasa'
);
Route
::
resource
(
'posts'
,
'PostController'
);
Route
::
resource
(
'pages'
,
'PageController'
);
Route
::
resource
(
'agendas'
,
'AgendaController'
);
...
...
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