File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -67,10 +67,11 @@ public function sub($route, $callback)
6767 * @since 20 Sep 2016
6868 * @param $route
6969 * @param $callback
70+ * @param $checkCallback
7071 */
71- public function subWithCheck ($ route , $ callback )
72+ public function subWithCheck ($ route , $ callback , $ checkCallback )
7273 {
73- if (SideNav:: checkStatus ( $ route ) === true ) {
74+ if ($ checkCallback === true ) {
7475 $ sub = SideNav::addSub ($ route , $ callback );
7576 array_push ($ this ->submenu , $ sub );
7677 }
Original file line number Diff line number Diff line change @@ -109,10 +109,10 @@ public static function register($route, $callback)
109109 * @param $callback
110110 * @param $checkCallback
111111 */
112- public static function registerWithCheck ($ route , $ callback , $ checkCallback = null )
112+ public static function registerWithCheck ($ route , $ callback , $ checkCallback )
113113 {
114114 // check status of route
115- if (self :: checkStatus ( $ route , $ checkCallback) ) {
115+ if ($ checkCallback === true ) {
116116 self ::register ($ route , $ callback );
117117 }
118118 }
@@ -210,41 +210,4 @@ public static function checkGroupId($type)
210210 return false ;
211211 }
212212
213- /**
214- * Check user status
215- *
216- * @author Alireza Josheghani <a.josheghani@anetwork.ir>
217- * @since 19 Sep 2016
218- * @param $route
219- * @param $callback
220- * @return bool
221- */
222- public static function checkStatus ($ route ,$ callback = false )
223- {
224- if ($ callback instanceof \Closure) {
225- if ($ callback ()) {
226- return true ;
227- }
228- }
229-
230- // check status class name
231- $ obj = self ::$ checkStatusObject ['object ' ];
232-
233- // check status method name
234- $ method = self ::$ checkStatusObject ['method ' ];
235-
236- if (class_exists ($ obj )) {
237- // instance of class
238- $ class = new $ obj ;
239-
240- // call method of class
241- if ($ class ->$ method ($ route )) {
242- return true ;
243- }
244- return false ;
245- } else {
246- throw new \Exception ("The CheckStatus class not found ! " );
247- }
248- }
249-
250213}
You can’t perform that action at this time.
0 commit comments