Commit 48f5cadf by Bagus Pambudi

fix bug auto translate diatas 5rb karakter(update)

parent bbf8871f
......@@ -50,11 +50,11 @@ class GalleryController extends Controller
// dd($request);
$request -> validate([
'title' => 'required',
'gallery' => 'required|mimes:jpg,jpeg,png|max : 3072'
'gallery' => 'mimes:jpg,jpeg,png|max : 3072'
], [
'title.required' => 'Nama gallery wajib diisi',
// 'title.max' => 'Nama gallery terlalu panjang',
'gallery.required' => 'Gambar wajib diupload',
// 'gallery.required' => 'Gambar wajib diupload',
'gallery.mimes' => 'File yang diupload harus berupa JPG, JPEG, dan PNG',
'gallery.max' => 'Ukuran gambar maksimal 3 MB'
]);
......
......@@ -303,11 +303,12 @@ class PageController extends Controller
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['title']));
if (strlen($data['content']) < 5000) {
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe','section','small','button']));
$dataEn['title'] = $title;
$dataEn['content'] = $content;
}
$dataEn['title'] = $title;
}
$this->repoEn->update($dataEn, $page);
}
......@@ -324,11 +325,12 @@ class PageController extends Controller
}
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['title']));
if (strlen($data['content']) < 5000) {
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe','section','small','button']));
$dataDe['title'] = $title;
$dataDe['content'] = $content;
}
$dataDe['title'] = $title;
}
$this->repoDe->update($dataDe, $page);
}
......@@ -346,11 +348,12 @@ class PageController extends Controller
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['title']));
if (strlen($data['content']) < 5000) {
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe','section','small','button']));
$dataSa['title'] = $title;
$dataSa['content'] = $content;
}
$dataSa['title'] = $title;
}
$this->repoSa->update($dataSa, $page);
}
......@@ -368,11 +371,12 @@ class PageController extends Controller
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['title']));
if (strlen($data['content']) < 5000) {
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'td', 'th', 'tr', 'iframe','section','small','button']));
$dataZh['title'] = $title;
$dataZh['content'] = $content;
}
$dataZh['title'] = $title;
}
$this->repoZh->update($dataZh, $page);
}
......
......@@ -426,11 +426,12 @@ class PostController extends Controller
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['title']));
if (strlen($data['content']) < 5000) {
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th', 'iframe','section']));
$dataEn['title'] = $title;
$dataEn['content'] = $content;
}
$dataEn['title'] = $title;
}
$this->repoEn->update($dataEn, $post);
}
......@@ -448,10 +449,12 @@ class PostController extends Controller
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['title']));
if (strlen($data['content']) < 5000) {
$content = $trans->translate($this->SOURCE, $this->TARGETDE, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th', 'iframe','section']));
$dataDe['title'] = $title;
$dataDe['content'] = $content;
}
$dataDe['title'] = $title;
}
$this->repoDe->update($dataDe, $post);
}
......@@ -469,10 +472,12 @@ class PostController extends Controller
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['title']));
if (strlen($data['content']) < 5000) {
$content = $trans->translate($this->SOURCE, $this->TARGETSA, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th', 'iframe','section']));
$dataSa['title'] = $title;
$dataSa['content'] = $content;
}
$dataSa['title'] = $title;
}
$this->repoSa->update($dataSa, $post);
}
......@@ -489,10 +494,12 @@ class PostController extends Controller
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['title']));
if (strlen($data['content']) < 5000) {
$content = $trans->translate($this->SOURCE, $this->TARGETZH, strip_tags($data['content'], ['a', 'br', 'p', 'b', 'i', 'u', 'ul', 'li', 'ol', 'img', 'table', 'tr', 'td', 'th', 'iframe','section']));
$dataZh['title'] = $title;
$dataZh['content'] = $content;
}
$dataZh['title'] = $title;
}
$this->repoZh->update($dataZh, $post);
}
......
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