Commit 48f5cadf by Bagus Pambudi

fix bug auto translate diatas 5rb karakter(update)

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