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
434a610b
Commit
434a610b
authored
May 13, 2020
by
Aan Choesni Herlingga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix store if content is blank
parent
b7188745
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
38 deletions
+77
-38
app/Http/Controllers/Webprofile/Backend/CategoryController.php
+14
-8
app/Http/Controllers/Webprofile/Backend/InformationController.php
+20
-9
app/Http/Controllers/Webprofile/Backend/PageController.php
+20
-9
app/Http/Controllers/Webprofile/Backend/PostController.php
+22
-12
app/Repositories/Webprofile/En/PostRepository.php
+1
-0
No files found.
app/Http/Controllers/Webprofile/Backend/CategoryController.php
View file @
434a610b
...
@@ -19,10 +19,11 @@ class CategoryController extends Controller
...
@@ -19,10 +19,11 @@ class CategoryController extends Controller
public
function
__construct
(
public
function
__construct
(
CategoryRepository
$repo
,
CategoryRepository
$repo
,
EnCategoryRepository
$repoEn
EnCategoryRepository
$repoEn
){
)
{
$this
->
repo
=
$repo
;
$this
->
repo
=
$repo
;
$this
->
repoEn
=
$repoEn
;
$this
->
repoEn
=
$repoEn
;
}
}
/**
/**
* Display a listing of the resource.
* Display a listing of the resource.
*
*
...
@@ -32,6 +33,7 @@ class CategoryController extends Controller
...
@@ -32,6 +33,7 @@ class CategoryController extends Controller
{
{
if
(
$request
->
ajax
())
{
if
(
$request
->
ajax
())
{
$data
=
$this
->
repo
->
get
([
'rEn'
]);
$data
=
$this
->
repo
->
get
([
'rEn'
]);
return
$this
->
repo
->
datatable
(
$data
);
return
$this
->
repo
->
datatable
(
$data
);
}
}
...
@@ -51,7 +53,8 @@ class CategoryController extends Controller
...
@@ -51,7 +53,8 @@ class CategoryController extends Controller
/**
/**
* Store a newly created resource in storage.
* Store a newly created resource in storage.
*
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
store
(
Request
$request
)
public
function
store
(
Request
$request
)
...
@@ -81,18 +84,19 @@ class CategoryController extends Controller
...
@@ -81,18 +84,19 @@ class CategoryController extends Controller
/**
/**
* Display the specified resource.
* Display the specified resource.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
show
(
$id
)
public
function
show
(
$id
)
{
{
//
}
}
/**
/**
* Show the form for editing the specified resource.
* Show the form for editing the specified resource.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
edit
(
$id
)
public
function
edit
(
$id
)
...
@@ -109,8 +113,9 @@ class CategoryController extends Controller
...
@@ -109,8 +113,9 @@ class CategoryController extends Controller
/**
/**
* Update the specified resource in storage.
* Update the specified resource in storage.
*
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
update
(
Request
$request
,
$id
)
public
function
update
(
Request
$request
,
$id
)
...
@@ -138,7 +143,8 @@ class CategoryController extends Controller
...
@@ -138,7 +143,8 @@ class CategoryController extends Controller
/**
/**
* Remove the specified resource from storage.
* Remove the specified resource from storage.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
destroy
(
$id
)
public
function
destroy
(
$id
)
...
...
app/Http/Controllers/Webprofile/Backend/InformationController.php
View file @
434a610b
...
@@ -20,10 +20,11 @@ class InformationController extends Controller
...
@@ -20,10 +20,11 @@ class InformationController extends Controller
public
function
__construct
(
public
function
__construct
(
InformationRepository
$repo
,
InformationRepository
$repo
,
EnInformationRepository
$repoEn
EnInformationRepository
$repoEn
){
)
{
$this
->
repo
=
$repo
;
$this
->
repo
=
$repo
;
$this
->
repoEn
=
$repoEn
;
$this
->
repoEn
=
$repoEn
;
}
}
/**
/**
* Display a listing of the resource.
* Display a listing of the resource.
*
*
...
@@ -33,6 +34,7 @@ class InformationController extends Controller
...
@@ -33,6 +34,7 @@ class InformationController extends Controller
{
{
if
(
$request
->
ajax
())
{
if
(
$request
->
ajax
())
{
$data
=
$this
->
repo
->
get
([
'rEn'
]);
$data
=
$this
->
repo
->
get
([
'rEn'
]);
return
$this
->
repo
->
datatable
(
$data
);
return
$this
->
repo
->
datatable
(
$data
);
}
}
...
@@ -58,7 +60,8 @@ class InformationController extends Controller
...
@@ -58,7 +60,8 @@ class InformationController extends Controller
/**
/**
* Store a newly created resource in storage.
* Store a newly created resource in storage.
*
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
store
(
Request
$request
)
public
function
store
(
Request
$request
)
...
@@ -82,6 +85,11 @@ class InformationController extends Controller
...
@@ -82,6 +85,11 @@ class InformationController extends Controller
{
{
$trans
=
new
GoogleTranslate
();
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
$data
[
'title'
]);
$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'
]));
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'content'
]));
$dataEn
[
'information_id'
]
=
$information
->
id
;
$dataEn
[
'information_id'
]
=
$information
->
id
;
...
@@ -94,25 +102,26 @@ class InformationController extends Controller
...
@@ -94,25 +102,26 @@ class InformationController extends Controller
/**
/**
* Display the specified resource.
* Display the specified resource.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
show
(
$id
)
public
function
show
(
$id
)
{
{
//
}
}
/**
/**
* Show the form for editing the specified resource.
* Show the form for editing the specified resource.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
edit
(
$id
)
public
function
edit
(
$id
)
{
{
$data
=
$this
->
repo
->
findId
(
$id
);
$data
=
$this
->
repo
->
findId
(
$id
);
$categories
=
Categories
::
pluck
(
'name'
,
'id'
);
$categories
=
Categories
::
pluck
(
'name'
,
'id'
);
$data
=
[
$data
=
[
'data'
=>
$data
,
'data'
=>
$data
,
'categories'
=>
$categories
,
'categories'
=>
$categories
,
...
@@ -124,8 +133,9 @@ class InformationController extends Controller
...
@@ -124,8 +133,9 @@ class InformationController extends Controller
/**
/**
* Update the specified resource in storage.
* Update the specified resource in storage.
*
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
update
(
Request
$request
,
$id
)
public
function
update
(
Request
$request
,
$id
)
...
@@ -155,7 +165,8 @@ class InformationController extends Controller
...
@@ -155,7 +165,8 @@ class InformationController extends Controller
/**
/**
* Remove the specified resource from storage.
* Remove the specified resource from storage.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
destroy
(
$id
)
public
function
destroy
(
$id
)
...
...
app/Http/Controllers/Webprofile/Backend/PageController.php
View file @
434a610b
...
@@ -20,10 +20,11 @@ class PageController extends Controller
...
@@ -20,10 +20,11 @@ class PageController extends Controller
public
function
__construct
(
public
function
__construct
(
PagesRepository
$repo
,
PagesRepository
$repo
,
EnPagesRepository
$repoEn
EnPagesRepository
$repoEn
){
)
{
$this
->
repo
=
$repo
;
$this
->
repo
=
$repo
;
$this
->
repoEn
=
$repoEn
;
$this
->
repoEn
=
$repoEn
;
}
}
/**
/**
* Display a listing of the resource.
* Display a listing of the resource.
*
*
...
@@ -33,6 +34,7 @@ class PageController extends Controller
...
@@ -33,6 +34,7 @@ class PageController extends Controller
{
{
if
(
$request
->
ajax
())
{
if
(
$request
->
ajax
())
{
$data
=
$this
->
repo
->
get
([
'rEn'
]);
$data
=
$this
->
repo
->
get
([
'rEn'
]);
return
$this
->
repo
->
datatable
(
$data
);
return
$this
->
repo
->
datatable
(
$data
);
}
}
...
@@ -58,7 +60,8 @@ class PageController extends Controller
...
@@ -58,7 +60,8 @@ class PageController extends Controller
/**
/**
* Store a newly created resource in storage.
* Store a newly created resource in storage.
*
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
store
(
Request
$request
)
public
function
store
(
Request
$request
)
...
@@ -80,6 +83,11 @@ class PageController extends Controller
...
@@ -80,6 +83,11 @@ class PageController extends Controller
{
{
$trans
=
new
GoogleTranslate
();
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
$data
[
'title'
]);
$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'
]));
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'content'
]));
$dataEn
[
'page_id'
]
=
$page
->
id
;
$dataEn
[
'page_id'
]
=
$page
->
id
;
...
@@ -92,25 +100,26 @@ class PageController extends Controller
...
@@ -92,25 +100,26 @@ class PageController extends Controller
/**
/**
* Display the specified resource.
* Display the specified resource.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
show
(
$id
)
public
function
show
(
$id
)
{
{
//
}
}
/**
/**
* Show the form for editing the specified resource.
* Show the form for editing the specified resource.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
edit
(
$id
)
public
function
edit
(
$id
)
{
{
$data
=
$this
->
repo
->
findId
(
$id
);
$data
=
$this
->
repo
->
findId
(
$id
);
$categories
=
Categories
::
pluck
(
'name'
,
'id'
);
$categories
=
Categories
::
pluck
(
'name'
,
'id'
);
$data
=
[
$data
=
[
'data'
=>
$data
,
'data'
=>
$data
,
'categories'
=>
$categories
,
'categories'
=>
$categories
,
...
@@ -122,8 +131,9 @@ class PageController extends Controller
...
@@ -122,8 +131,9 @@ class PageController extends Controller
/**
/**
* Update the specified resource in storage.
* Update the specified resource in storage.
*
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
update
(
Request
$request
,
$id
)
public
function
update
(
Request
$request
,
$id
)
...
@@ -150,7 +160,8 @@ class PageController extends Controller
...
@@ -150,7 +160,8 @@ class PageController extends Controller
/**
/**
* Remove the specified resource from storage.
* Remove the specified resource from storage.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
destroy
(
$id
)
public
function
destroy
(
$id
)
...
...
app/Http/Controllers/Webprofile/Backend/PostController.php
View file @
434a610b
...
@@ -8,7 +8,6 @@ use App\Models\Webprofile\Categories;
...
@@ -8,7 +8,6 @@ use App\Models\Webprofile\Categories;
use
App\Repositories\Webprofile\En\PostRepository
as
EnPostRepository
;
use
App\Repositories\Webprofile\En\PostRepository
as
EnPostRepository
;
use
App\Repositories\Webprofile\PostRepository
;
use
App\Repositories\Webprofile\PostRepository
;
use
Statickidz\GoogleTranslate
;
use
Statickidz\GoogleTranslate
;
use
Illuminate\Support\Str
;
class
PostController
extends
Controller
class
PostController
extends
Controller
{
{
...
@@ -21,10 +20,11 @@ class PostController extends Controller
...
@@ -21,10 +20,11 @@ class PostController extends Controller
public
function
__construct
(
public
function
__construct
(
PostRepository
$repo
,
PostRepository
$repo
,
EnPostRepository
$repoEn
EnPostRepository
$repoEn
){
)
{
$this
->
repo
=
$repo
;
$this
->
repo
=
$repo
;
$this
->
repoEn
=
$repoEn
;
$this
->
repoEn
=
$repoEn
;
}
}
/**
/**
* Display a listing of the resource.
* Display a listing of the resource.
*
*
...
@@ -34,6 +34,7 @@ class PostController extends Controller
...
@@ -34,6 +34,7 @@ class PostController extends Controller
{
{
if
(
$request
->
ajax
())
{
if
(
$request
->
ajax
())
{
$data
=
$this
->
repo
->
get
([
'rEn'
]);
$data
=
$this
->
repo
->
get
([
'rEn'
]);
return
$this
->
repo
->
datatable
(
$data
);
return
$this
->
repo
->
datatable
(
$data
);
}
}
...
@@ -59,7 +60,8 @@ class PostController extends Controller
...
@@ -59,7 +60,8 @@ class PostController extends Controller
/**
/**
* Store a newly created resource in storage.
* Store a newly created resource in storage.
*
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
store
(
Request
$request
)
public
function
store
(
Request
$request
)
...
@@ -74,7 +76,7 @@ class PostController extends Controller
...
@@ -74,7 +76,7 @@ class PostController extends Controller
$tipe
=
'thumbnail'
;
$tipe
=
'thumbnail'
;
if
(
$request
->
hasFile
(
$tipe
))
{
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
->
upload
(
$img
[
$tipe
],
$request
,
$tipe
);
$this
->
repo
->
update
(
$img
,
$save
);
$this
->
repo
->
update
(
$img
,
$save
);
...
@@ -92,6 +94,11 @@ class PostController extends Controller
...
@@ -92,6 +94,11 @@ class PostController extends Controller
{
{
$trans
=
new
GoogleTranslate
();
$trans
=
new
GoogleTranslate
();
$title
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
$data
[
'title'
]);
$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'
]));
$content
=
$trans
->
translate
(
$this
->
SOURCE
,
$this
->
TARGET
,
strip_tags
(
$data
[
'content'
]));
$dataEn
[
'post_id'
]
=
$post
->
id
;
$dataEn
[
'post_id'
]
=
$post
->
id
;
...
@@ -104,18 +111,19 @@ class PostController extends Controller
...
@@ -104,18 +111,19 @@ class PostController extends Controller
/**
/**
* Display the specified resource.
* Display the specified resource.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
show
(
$id
)
public
function
show
(
$id
)
{
{
//
}
}
/**
/**
* Show the form for editing the specified resource.
* Show the form for editing the specified resource.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
edit
(
$id
)
public
function
edit
(
$id
)
...
@@ -123,7 +131,7 @@ class PostController extends Controller
...
@@ -123,7 +131,7 @@ class PostController extends Controller
$setting
=
webprofilesetting
();
$setting
=
webprofilesetting
();
$data
=
$this
->
repo
->
findId
(
$id
,
[
'rEn'
]);
$data
=
$this
->
repo
->
findId
(
$id
,
[
'rEn'
]);
$categories
=
Categories
::
pluck
(
'name'
,
'id'
);
$categories
=
Categories
::
pluck
(
'name'
,
'id'
);
$data
=
[
$data
=
[
'data'
=>
$data
,
'data'
=>
$data
,
'categories'
=>
$categories
,
'categories'
=>
$categories
,
...
@@ -136,8 +144,9 @@ class PostController extends Controller
...
@@ -136,8 +144,9 @@ class PostController extends Controller
/**
/**
* Update the specified resource in storage.
* Update the specified resource in storage.
*
*
* @param \Illuminate\Http\Request $request
* @param \Illuminate\Http\Request $request
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
update
(
Request
$request
,
$id
)
public
function
update
(
Request
$request
,
$id
)
...
@@ -154,7 +163,7 @@ class PostController extends Controller
...
@@ -154,7 +163,7 @@ class PostController extends Controller
$tipe
=
'thumbnail'
;
$tipe
=
'thumbnail'
;
if
(
$request
->
hasFile
(
$tipe
))
{
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
->
upload
(
$img
[
$tipe
],
$request
,
$tipe
);
$this
->
repo
->
update
(
$img
,
$post
);
$this
->
repo
->
update
(
$img
,
$post
);
...
@@ -176,7 +185,8 @@ class PostController extends Controller
...
@@ -176,7 +185,8 @@ class PostController extends Controller
/**
/**
* Remove the specified resource from storage.
* Remove the specified resource from storage.
*
*
* @param int $id
* @param int $id
*
* @return \Illuminate\Http\Response
* @return \Illuminate\Http\Response
*/
*/
public
function
destroy
(
$id
)
public
function
destroy
(
$id
)
...
...
app/Repositories/Webprofile/En/PostRepository.php
View file @
434a610b
...
@@ -15,6 +15,7 @@ class PostRepository extends Repository
...
@@ -15,6 +15,7 @@ class PostRepository extends Repository
public
function
get
()
public
function
get
()
{
{
}
}
public
function
paginate
()
public
function
paginate
()
{
{
}
}
...
...
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