@@ -34,7 +34,7 @@ |
||
34 | 34 | } |
35 | 35 | |
36 | 36 | DB::table("users")->where("id", auth()->id())->update($data); |
37 | - }catch (\Exception $e) { |
|
37 | + } catch (\Exception $e) { |
|
38 | 38 | Log::error($e); |
39 | 39 | return cb()->redirectBack(cbLang("something_went_wrong"),"warning"); |
40 | 40 | } |
@@ -32,11 +32,11 @@ |
||
32 | 32 | |
33 | 33 | return redirect(cb()->getDeveloperUrl()); |
34 | 34 | |
35 | - }else{ |
|
35 | + } else{ |
|
36 | 36 | return cb()->redirectBack( cbLang("password_and_username_is_wrong")); |
37 | 37 | } |
38 | 38 | |
39 | - }catch (CBValidationException $e) { |
|
39 | + } catch (CBValidationException $e) { |
|
40 | 40 | return cb()->redirect(cb()->getLoginUrl(),$e->getMessage(),'warning'); |
41 | 41 | } |
42 | 42 | } |
@@ -33,7 +33,9 @@ discard block |
||
33 | 33 | |
34 | 34 | public function getLogin() |
35 | 35 | { |
36 | - if(!auth()->guest()) return redirect(cb()->getAdminUrl()); |
|
36 | + if(!auth()->guest()) { |
|
37 | + return redirect(cb()->getAdminUrl()); |
|
38 | + } |
|
37 | 39 | |
38 | 40 | cbHook()->hookGetLogin(); |
39 | 41 | |
@@ -43,7 +45,9 @@ discard block |
||
43 | 45 | public function postLogin() |
44 | 46 | { |
45 | 47 | try{ |
46 | - if($this->isSuspendedLogin()) throw new CBValidationException(cbLang("you_have_been_suspended")); |
|
48 | + if($this->isSuspendedLogin()) { |
|
49 | + throw new CBValidationException(cbLang("you_have_been_suspended")); |
|
50 | + } |
|
47 | 51 | |
48 | 52 | cb()->validation([ |
49 | 53 | 'email'=>'required|email', |
@@ -58,7 +62,7 @@ discard block |
||
58 | 62 | $this->incrementFailedLogin(); |
59 | 63 | return redirect(cb()->getLoginUrl())->with(['message'=>cbLang('password_and_username_is_wrong'),'message_type'=>'warning']); |
60 | 64 | } |
61 | - }catch (CBValidationException $e) { |
|
65 | + } catch (CBValidationException $e) { |
|
62 | 66 | return cb()->redirect(cb()->getAdminUrl("login"),$e->getMessage(),'warning'); |
63 | 67 | } |
64 | 68 | } |
@@ -49,7 +49,7 @@ |
||
49 | 49 | |
50 | 50 | if($err) { |
51 | 51 | return $err; |
52 | - }else { |
|
52 | + } else { |
|
53 | 53 | return $response; |
54 | 54 | } |
55 | 55 | } |
@@ -58,7 +58,7 @@ |
||
58 | 58 | if (Request::is(cb()->getAdminPath())) { |
59 | 59 | if($dashboard = cbConfig("ADMIN_DASHBOARD_CONTROLLER")) { |
60 | 60 | cb()->routeGet("/", $dashboard); |
61 | - }else{ |
|
61 | + } else{ |
|
62 | 62 | cb()->routeGet("/", "\crocodicstudio\crudbooster\controllers\AdminDashboardController@getIndex"); |
63 | 63 | } |
64 | 64 | } |
@@ -69,7 +69,7 @@ |
||
69 | 69 | return cb()->redirect(cb()->getAdminUrl("login"),"Thank you for register. Now you can login to start your session :)","success"); |
70 | 70 | } |
71 | 71 | |
72 | - }catch (CBValidationException $e) { |
|
72 | + } catch (CBValidationException $e) { |
|
73 | 73 | return cb()->redirectBack($e->getMessage()); |
74 | 74 | } |
75 | 75 |
@@ -58,7 +58,7 @@ |
||
58 | 58 | return cb()->redirectBack("Your email is not registered"); |
59 | 59 | } |
60 | 60 | |
61 | - }catch (CBValidationException $e) { |
|
61 | + } catch (CBValidationException $e) { |
|
62 | 62 | return cb()->redirectBack($e->getMessage()); |
63 | 63 | } catch (\Exception $e) { |
64 | 64 | Log::error($e); |
@@ -14,8 +14,12 @@ |
||
14 | 14 | { |
15 | 15 | |
16 | 16 | public function getSubModule($subModuleKey) { |
17 | - if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
18 | - if(!verifyReferalUrl()) return cb()->redirect(module()->url(),"It looks like your url is incorrect"); |
|
17 | + if(!module()->canBrowse()) { |
|
18 | + return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
19 | + } |
|
20 | + if(!verifyReferalUrl()) { |
|
21 | + return cb()->redirect(module()->url(),"It looks like your url is incorrect"); |
|
22 | + } |
|
19 | 23 | |
20 | 24 | if($subModule = Cache::get("subModule".$subModuleKey)) { |
21 | 25 | $foreignKey = $subModule['foreignKey']; |
@@ -32,7 +32,9 @@ discard block |
||
32 | 32 | |
33 | 33 | public function getIndex() |
34 | 34 | { |
35 | - if(!module()->canBrowse()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
35 | + if(!module()->canBrowse()) { |
|
36 | + return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
37 | + } |
|
36 | 38 | |
37 | 39 | $query = $this->repository(); |
38 | 40 | $result = $query->paginate( request("limit")?:cbConfig("LIMIT_TABLE_DATA") ); |
@@ -43,7 +45,9 @@ discard block |
||
43 | 45 | |
44 | 46 | public function getAdd() |
45 | 47 | { |
46 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
48 | + if(!module()->canCreate()) { |
|
49 | + return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
50 | + } |
|
47 | 51 | |
48 | 52 | $data = []; |
49 | 53 | $data['page_title'] = $this->data['page_title'].' : '.cbLang('add'); |
@@ -53,7 +57,9 @@ discard block |
||
53 | 57 | |
54 | 58 | public function postAddSave() |
55 | 59 | { |
56 | - if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
60 | + if(!module()->canCreate()) { |
|
61 | + return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
62 | + } |
|
57 | 63 | |
58 | 64 | try { |
59 | 65 | $this->validation(); |
@@ -102,7 +108,9 @@ discard block |
||
102 | 108 | |
103 | 109 | public function getEdit($id) |
104 | 110 | { |
105 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
111 | + if(!module()->canUpdate()) { |
|
112 | + return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
113 | + } |
|
106 | 114 | |
107 | 115 | $data = []; |
108 | 116 | $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first(); |
@@ -113,7 +121,9 @@ discard block |
||
113 | 121 | |
114 | 122 | public function postEditSave($id) |
115 | 123 | { |
116 | - if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
124 | + if(!module()->canUpdate()) { |
|
125 | + return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
126 | + } |
|
117 | 127 | |
118 | 128 | try { |
119 | 129 | $this->validation(); |
@@ -162,7 +172,9 @@ discard block |
||
162 | 172 | |
163 | 173 | public function getDelete($id) |
164 | 174 | { |
165 | - if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
175 | + if(!module()->canDelete()) { |
|
176 | + return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
177 | + } |
|
166 | 178 | |
167 | 179 | if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) { |
168 | 180 | call_user_func($this->data['hook_before_delete'], $id); |
@@ -189,7 +201,9 @@ discard block |
||
189 | 201 | |
190 | 202 | public function getDetail($id) |
191 | 203 | { |
192 | - if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
204 | + if(!module()->canRead()) { |
|
205 | + return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area")); |
|
206 | + } |
|
193 | 207 | |
194 | 208 | $data = []; |
195 | 209 | $data['row'] = $this->repository()->where($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), $id)->first(); |
@@ -212,10 +226,10 @@ discard block |
||
212 | 226 | $key = $parameters[0]; |
213 | 227 | if(isset($this->data[$key])) { |
214 | 228 | return $this->data[$key]; |
215 | - }else{ |
|
229 | + } else{ |
|
216 | 230 | return null; |
217 | 231 | } |
218 | - }else{ |
|
232 | + } else{ |
|
219 | 233 | return null; |
220 | 234 | } |
221 | 235 | } |