Commit 434a610b by Aan Choesni Herlingga

bug fix store if content is blank

parent b7188745
......@@ -19,10 +19,11 @@ class CategoryController extends Controller
public function __construct(
CategoryRepository $repo,
EnCategoryRepository $repoEn
){
) {
$this->repo = $repo;
$this->repoEn = $repoEn;
}
/**
* Display a listing of the resource.
*
......@@ -32,6 +33,7 @@ class CategoryController extends Controller
{
if ($request->ajax()) {
$data = $this->repo->get(['rEn']);
return $this->repo->datatable($data);
}
......@@ -52,6 +54,7 @@ class CategoryController extends Controller
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
......@@ -82,17 +85,18 @@ class CategoryController extends Controller
* Display the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit($id)
......@@ -111,6 +115,7 @@ class CategoryController extends Controller
*
* @param \Illuminate\Http\Request $request
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
......@@ -139,6 +144,7 @@ class CategoryController extends Controller
* Remove the specified resource from storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
......
......@@ -20,10 +20,11 @@ class InformationController extends Controller
public function __construct(
InformationRepository $repo,
EnInformationRepository $repoEn
){
) {
$this->repo = $repo;
$this->repoEn = $repoEn;
}
/**
* Display a listing of the resource.
*
......@@ -33,6 +34,7 @@ class InformationController extends Controller
{
if ($request->ajax()) {
$data = $this->repo->get(['rEn']);
return $this->repo->datatable($data);
}
......@@ -59,6 +61,7 @@ class InformationController extends Controller
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
......@@ -82,6 +85,11 @@ class InformationController extends Controller
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGET, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content']));
$dataEn['information_id'] = $information->id;
......@@ -95,17 +103,18 @@ class InformationController extends Controller
* Display the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit($id)
......@@ -126,6 +135,7 @@ class InformationController extends Controller
*
* @param \Illuminate\Http\Request $request
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
......@@ -156,6 +166,7 @@ class InformationController extends Controller
* Remove the specified resource from storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
......
......@@ -20,10 +20,11 @@ class PageController extends Controller
public function __construct(
PagesRepository $repo,
EnPagesRepository $repoEn
){
) {
$this->repo = $repo;
$this->repoEn = $repoEn;
}
/**
* Display a listing of the resource.
*
......@@ -33,6 +34,7 @@ class PageController extends Controller
{
if ($request->ajax()) {
$data = $this->repo->get(['rEn']);
return $this->repo->datatable($data);
}
......@@ -59,6 +61,7 @@ class PageController extends Controller
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
......@@ -80,6 +83,11 @@ class PageController extends Controller
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGET, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content']));
$dataEn['page_id'] = $page->id;
......@@ -93,17 +101,18 @@ class PageController extends Controller
* Display the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit($id)
......@@ -124,6 +133,7 @@ class PageController extends Controller
*
* @param \Illuminate\Http\Request $request
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
......@@ -151,6 +161,7 @@ class PageController extends Controller
* Remove the specified resource from storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
......
......@@ -8,7 +8,6 @@ use App\Models\Webprofile\Categories;
use App\Repositories\Webprofile\En\PostRepository as EnPostRepository;
use App\Repositories\Webprofile\PostRepository;
use Statickidz\GoogleTranslate;
use Illuminate\Support\Str;
class PostController extends Controller
{
......@@ -21,10 +20,11 @@ class PostController extends Controller
public function __construct(
PostRepository $repo,
EnPostRepository $repoEn
){
) {
$this->repo = $repo;
$this->repoEn = $repoEn;
}
/**
* Display a listing of the resource.
*
......@@ -34,6 +34,7 @@ class PostController extends Controller
{
if ($request->ajax()) {
$data = $this->repo->get(['rEn']);
return $this->repo->datatable($data);
}
......@@ -60,6 +61,7 @@ class PostController extends Controller
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public function store(Request $request)
......@@ -74,7 +76,7 @@ class PostController extends Controller
$tipe = 'thumbnail';
if ($request->hasFile($tipe)) {
$img[$tipe] = $save->id . '.' . $request->file($tipe)->guessClientExtension();
$img[$tipe] = $save->id.'.'.$request->file($tipe)->guessClientExtension();
$this->repo->upload($img[$tipe], $request, $tipe);
$this->repo->update($img, $save);
......@@ -92,6 +94,11 @@ class PostController extends Controller
{
$trans = new GoogleTranslate();
$title = $trans->translate($this->SOURCE, $this->TARGET, $data['title']);
if (strip_tags($data['content']) == null) {
$data['content'] = 'kosong';
}
$content = $trans->translate($this->SOURCE, $this->TARGET, strip_tags($data['content']));
$dataEn['post_id'] = $post->id;
......@@ -105,17 +112,18 @@ class PostController extends Controller
* Display the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function show($id)
{
//
}
/**
* Show the form for editing the specified resource.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function edit($id)
......@@ -138,6 +146,7 @@ class PostController extends Controller
*
* @param \Illuminate\Http\Request $request
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function update(Request $request, $id)
......@@ -154,7 +163,7 @@ class PostController extends Controller
$tipe = 'thumbnail';
if ($request->hasFile($tipe)) {
$img[$tipe] = $post->id . '.' . $request->file($tipe)->guessClientExtension();
$img[$tipe] = $post->id.'.'.$request->file($tipe)->guessClientExtension();
$this->repo->upload($img[$tipe], $request, $tipe);
$this->repo->update($img, $post);
......@@ -177,6 +186,7 @@ class PostController extends Controller
* Remove the specified resource from storage.
*
* @param int $id
*
* @return \Illuminate\Http\Response
*/
public function destroy($id)
......
......@@ -15,6 +15,7 @@ class PostRepository extends Repository
public function get()
{
}
public function paginate()
{
}
......
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