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
d1398a1f
Commit
d1398a1f
authored
Oct 19, 2020
by
Aan Choesni Herlingga
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug fix updown menu
parent
a749365a
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
19 additions
and
20 deletions
+19
-20
app/Http/Controllers/Webprofile/Backend/MenuController.php
+19
-20
No files found.
app/Http/Controllers/Webprofile/Backend/MenuController.php
View file @
d1398a1f
...
...
@@ -2,17 +2,17 @@
namespace
App\Http\Controllers\Webprofile\Backend
;
use
App\Models\Webprofile\Pages
;
use
Illuminate\Http\Request
;
use
Alert
;
use
App\Http\Controllers\Controller
;
use
App\Models\Webprofile\Menu
;
use
Validator
;
use
Alert
;
use
App\Models\Webprofile\Pages
;
use
App\Repositories\Webprofile\En\MenuRepository
;
use
App\Repositories\Webprofile\MenuRepository
as
WebprofileMenuRepository
;
use
Crypt
;
use
Auth
;
use
Crypt
;
use
Illuminate\Http\Request
;
use
Statickidz\GoogleTranslate
;
use
Validator
;
class
MenuController
extends
Controller
{
...
...
@@ -83,16 +83,17 @@ class MenuController extends Controller
return
$cmenu
;
}
public
function
menu_up
(
$id
)
public
function
menu_up
(
$id
,
$urut
=
1
)
{
$cur_menu
=
Menu
::
where
(
'id'
,
Crypt
::
decrypt
(
$id
))
->
first
();
if
(
$cur_menu
->
parentlevel
==
null
)
{
$up_menu
=
Menu
::
where
(
'level'
,
$cur_menu
->
level
)
->
where
(
'urutan'
,
(
int
)
$cur_menu
->
urutan
-
1
)
->
first
();
$up_menu
=
Menu
::
where
(
'level'
,
$cur_menu
->
level
)
->
where
(
'urutan'
,
(
int
)
$cur_menu
->
urutan
-
$urut
)
->
first
();
}
if
(
$cur_menu
->
parentlevel
!=
null
)
{
$up_menu
=
Menu
::
where
(
'parent'
,
$cur_menu
->
parent
)
->
where
(
'level'
,
$cur_menu
->
level
)
->
where
(
'urutan'
,
(
int
)
$cur_menu
->
urutan
-
1
)
->
first
();
$up_menu
=
Menu
::
where
(
'parent'
,
$cur_menu
->
parent
)
->
where
(
'level'
,
$cur_menu
->
level
)
->
where
(
'urutan'
,
(
int
)
$cur_menu
->
urutan
-
$urut
)
->
first
();
}
if
(
$up_menu
)
{
Menu
::
where
(
'id'
,
Crypt
::
decrypt
(
$id
))
->
update
([
'urutan'
=>
$up_menu
->
urutan
,
'userid_created'
=>
Auth
::
user
()
->
name
,
...
...
@@ -108,16 +109,20 @@ class MenuController extends Controller
return
redirect
()
->
route
(
'menu.index'
);
}
public
function
menu_down
(
$id
)
return
$this
->
menu_up
(
$id
,
$urut
+
1
);
}
public
function
menu_down
(
$id
,
$urut
=
1
)
{
$cur_menu
=
Menu
::
where
(
'id'
,
Crypt
::
decrypt
(
$id
))
->
first
();
if
(
$cur_menu
->
parentlevel
==
null
)
{
$up_menu
=
Menu
::
where
(
'level'
,
$cur_menu
->
level
)
->
where
(
'urutan'
,
(
int
)
$cur_menu
->
urutan
+
1
)
->
first
();
$up_menu
=
Menu
::
where
(
'level'
,
$cur_menu
->
level
)
->
where
(
'urutan'
,
(
int
)
$cur_menu
->
urutan
+
$urut
)
->
first
();
}
if
(
$cur_menu
->
parentlevel
!=
null
)
{
$up_menu
=
Menu
::
where
(
'parent'
,
$cur_menu
->
parent
)
->
where
(
'level'
,
$cur_menu
->
level
)
->
where
(
'urutan'
,
(
int
)
$cur_menu
->
urutan
+
1
)
->
first
();
$up_menu
=
Menu
::
where
(
'parent'
,
$cur_menu
->
parent
)
->
where
(
'level'
,
$cur_menu
->
level
)
->
where
(
'urutan'
,
(
int
)
$cur_menu
->
urutan
+
$urut
)
->
first
();
}
if
(
$up_menu
)
{
Menu
::
where
(
'id'
,
Crypt
::
decrypt
(
$id
))
->
update
([
'urutan'
=>
$up_menu
->
urutan
,
'userid_created'
=>
Auth
::
user
()
->
name
,
...
...
@@ -133,6 +138,9 @@ class MenuController extends Controller
return
redirect
()
->
route
(
'menu.index'
);
}
return
$this
->
menu_down
(
$id
,
$urut
+
1
);
}
/**
* Show the form for creating a new resource.
*
...
...
@@ -145,8 +153,6 @@ class MenuController extends Controller
/**
* Store a newly created resource in storage.
*
* @param \Illuminate\Http\Request $request
*
* @return \Illuminate\Http\Response
*/
public
function
store
(
Request
$request
)
...
...
@@ -269,8 +275,6 @@ class MenuController extends Controller
/**
* Show the form for editing the specified resource.
*
* @param \App\Models\Menu $menu
*
* @return \Illuminate\Http\Response
*/
public
function
edit
(
$id
)
...
...
@@ -290,9 +294,6 @@ class MenuController extends Controller
/**
* Update the specified resource in storage.
*
* @param \Illuminate\Http\Request $request
* @param \App\Models\Menu $menu
*
* @return \Illuminate\Http\Response
*/
public
function
update
(
Request
$request
,
$id
)
...
...
@@ -313,8 +314,6 @@ class MenuController extends Controller
/**
* Remove the specified resource from storage.
*
* @param \App\Models\Menu $menu
*
* @return \Illuminate\Http\Response
*/
public
function
destroy
(
$id
)
...
...
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