Passed
Push — master ( ab23d3...456c2a )
by Ferry
05:06
created
src/controllers/RegisterController.php 2 patches
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -29,25 +29,25 @@  discard block
 block discarded – undo
29 29
                 "captcha"=>"required|integer"
30 30
             ]);
31 31
 
32
-            if(Session::get("captcha_result") != request("captcha")) {
32
+            if (Session::get("captcha_result") != request("captcha")) {
33 33
                 return cb()->redirectBack("The captcha that you input is wrong!");
34 34
             }
35 35
 
36
-            if($user = cb()->find("users",["email"=>request("email")])) {
36
+            if ($user = cb()->find("users", ["email"=>request("email")])) {
37 37
                 return cb()->redirectBack("The email you input has already exists!");
38 38
             }
39 39
 
40
-            if(getSetting("register_mail_verification")) {
41
-                Cache::put("register_".$token,[
40
+            if (getSetting("register_mail_verification")) {
41
+                Cache::put("register_".$token, [
42 42
                     "name"=>request("name"),
43 43
                     "email"=>request("email"),
44 44
                     "password"=>request("password")
45
-                ],now()->addHours(24));
45
+                ], now()->addHours(24));
46 46
 
47 47
                 $mail = new MailHelper();
48 48
                 $mail->to(request("email"));
49
-                $mail->sender(getSetting("register_mail_verification_sender","noreply@".$_SERVER['SERVER_NAME']),cb()->getAppName());
50
-                $mail->content("Verify Your Registration","
49
+                $mail->sender(getSetting("register_mail_verification_sender", "noreply@".$_SERVER['SERVER_NAME']), cb()->getAppName());
50
+                $mail->content("Verify Your Registration", "
51 51
                 Hi ".request("name")."<br/>
52 52
                 Thank you for register at ".cb()->getAppName()." to continue your registration, please click on the following link: <br/>
53 53
                 <p>$linkToken</p>
@@ -66,18 +66,18 @@  discard block
 block discarded – undo
66 66
                         "cb_roles_id"=> getSetting("register_as_role")
67 67
                     ]);
68 68
 
69
-                return cb()->redirect(cb()->getAdminUrl("login"),"Thank you for register. Now you can login to start your session :)","success");
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
 
76
-        return cb()->redirectBack("We've sent you an confirmation email. Please click the link inside the email","success");
76
+        return cb()->redirectBack("We've sent you an confirmation email. Please click the link inside the email", "success");
77 77
     }
78 78
 
79 79
     public function postContinueRegister($token) {
80
-        if($token = Cache::get("register_".$token)) {
80
+        if ($token = Cache::get("register_".$token)) {
81 81
             DB::table("users")
82 82
                 ->insert([
83 83
                     "created_at"=>date("Y-m-d H:i:s"),
@@ -87,9 +87,9 @@  discard block
 block discarded – undo
87 87
                     "cb_roles_id"=> getSetting("register_as_role")
88 88
                 ]);
89 89
 
90
-            return cb()->redirect(cb()->getAdminUrl("login"),"Thank you for register. Now you can login to start your session :)","success");
90
+            return cb()->redirect(cb()->getAdminUrl("login"), "Thank you for register. Now you can login to start your session :)", "success");
91 91
         } else {
92
-            return cb()->redirect(cb()->getAdminUrl("login"),"It looks like the URL has been expired!");
92
+            return cb()->redirect(cb()->getAdminUrl("login"), "It looks like the URL has been expired!");
93 93
         }
94 94
     }
95 95
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -69,7 +69,7 @@
 block discarded – undo
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
 
Please login to merge, or discard this patch.
src/controllers/AuthSuspend.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -28,11 +28,11 @@
 block discarded – undo
28 28
     {
29 29
         $key = md5(request()->ip().request()->userAgent());
30 30
 
31
-        if(Cache::has("loginSuspended".$key)) {
31
+        if (Cache::has("loginSuspended".$key)) {
32 32
             return true;
33 33
         }
34 34
 
35
-        if(getSetting("AUTO_SUSPEND_LOGIN") && Cache::get("loginFailed".$key) >= getSetting("AUTO_SUSPEND_LOGIN")) {
35
+        if (getSetting("AUTO_SUSPEND_LOGIN") && Cache::get("loginFailed".$key) >= getSetting("AUTO_SUSPEND_LOGIN")) {
36 36
             Cache::put("loginSuspended".$key, true, 30);
37 37
             $this->clearSuspendAttempt();
38 38
             return true;
Please login to merge, or discard this patch.
src/controllers/DeveloperMiscellaneousController.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -24,19 +24,19 @@
 block discarded – undo
24 24
 
25 25
     public function getIndex() {
26 26
         $data = [];
27
-        return view($this->view.".index",$data);
27
+        return view($this->view.".index", $data);
28 28
     }
29 29
 
30 30
     public function postSave()
31 31
     {
32
-        foreach(request()->except("_token") as $key=>$val) {
33
-            putSetting( $key,  $val);
32
+        foreach (request()->except("_token") as $key=>$val) {
33
+            putSetting($key, $val);
34 34
         }
35 35
 
36
-        putSetting("enable_register",request("enable_register"));
36
+        putSetting("enable_register", request("enable_register"));
37 37
         putSetting("enable_forget", request("enable_forget"));
38 38
         putSetting("register_mail_verification", request("register_mail_verification"));
39 39
 
40
-        return cb()->redirectBack("Setting has been updated!","success");
40
+        return cb()->redirectBack("Setting has been updated!", "success");
41 41
     }
42 42
 }
43 43
\ No newline at end of file
Please login to merge, or discard this patch.
src/controllers/DeveloperSecurityController.php 1 patch
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
 
25 25
     public function getIndex() {
26 26
         $data = [];
27
-        return view($this->view.".index",$data);
27
+        return view($this->view.".index", $data);
28 28
     }
29 29
 
30 30
     public function postSave()
@@ -39,15 +39,15 @@  discard block
 block discarded – undo
39 39
         putSetting("AUTO_REDIRECT_TO_LOGIN", request("AUTO_REDIRECT_TO_LOGIN"));
40 40
         putSetting("LOGIN_NOTIFICATION", request("LOGIN_NOTIFICATION"));
41 41
 
42
-        if(request("htaccess_ServerSignature")) {
42
+        if (request("htaccess_ServerSignature")) {
43 43
             putHtaccess("ServerSignature Off");
44 44
         }
45 45
 
46
-        if(request("htaccess_IndexIgnore")) {
46
+        if (request("htaccess_IndexIgnore")) {
47 47
             putHtaccess("IndexIgnore *");
48 48
         }
49 49
 
50
-        if(request("htaccess_dotAccess")) {
50
+        if (request("htaccess_dotAccess")) {
51 51
 putHtaccess("
52 52
 <FilesMatch \"^\.\">
53 53
 Order allow,deny
@@ -55,11 +55,11 @@  discard block
 block discarded – undo
55 55
 </FilesMatch>");
56 56
         }
57 57
 
58
-        if(request("htaccess_preventVendor")) {
58
+        if (request("htaccess_preventVendor")) {
59 59
             putHtaccess("RewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]");
60 60
         }
61 61
 
62 62
 
63
-        return cb()->redirectBack("Security has been updated!","success");
63
+        return cb()->redirectBack("Security has been updated!", "success");
64 64
     }
65 65
 }
66 66
\ No newline at end of file
Please login to merge, or discard this patch.
src/controllers/ForgetController.php 2 patches
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@  discard block
 block discarded – undo
24 24
         try {
25 25
             cb()->validation(['email'=>'required|email']);
26 26
 
27
-            if($user = cb()->find("users",["email"=>request("email")])) {
27
+            if ($user = cb()->find("users", ["email"=>request("email")])) {
28 28
                 $token = Str::random(6);
29 29
                 $linkToken = cb()->getAdminUrl("continue-reset/".$token);
30 30
                 Cache::put("forget_".$token, $user->id, now()->addHours(12));
@@ -37,8 +37,8 @@  discard block
 block discarded – undo
37 37
 
38 38
                 $mail = new MailHelper();
39 39
                 $mail->to($user->email);
40
-                $mail->sender(getSetting("forget_email_sender","noreply@".$_SERVER['SERVER_NAME']),cb()->getAppName());
41
-                $mail->content("Please Confirm Your Forgot Password","
40
+                $mail->sender(getSetting("forget_email_sender", "noreply@".$_SERVER['SERVER_NAME']), cb()->getAppName());
41
+                $mail->content("Please Confirm Your Forgot Password", "
42 42
                     Hi $user->name,<br/><br>
43 43
                     Someone with the detail bellow: <br/>
44 44
                     Time = ".now()->format("Y-m-d H:i:s")."<br/>
@@ -58,28 +58,28 @@  discard block
 block discarded – undo
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);
65 65
             return cb()->redirectBack(cbLang("something_went_wrong"));
66 66
         }
67 67
 
68
-        return cb()->redirectBack("We've sent you an email instruction. Please follow the instruction inside the email","success");
68
+        return cb()->redirectBack("We've sent you an email instruction. Please follow the instruction inside the email", "success");
69 69
     }
70 70
 
71 71
     public function getContinueReset($token) {
72
-        if(Cache::has("forget_".$token)) {
72
+        if (Cache::has("forget_".$token)) {
73 73
             $id = Cache::get("forget_".$token);
74 74
             $newPassword = Str::random(6);
75 75
             cb()->update("users", $id, ["password"=>Hash::make($newPassword)]);
76 76
 
77
-            $user = cb()->find("users",$id);
77
+            $user = cb()->find("users", $id);
78 78
 
79 79
             $mail = new MailHelper();
80 80
             $mail->to($user->email);
81
-            $mail->sender(getSetting("forget_email_sender","noreply@".$_SERVER['SERVER_NAME']),cb()->getAppName());
82
-            $mail->content("This Is Your New Password","
81
+            $mail->sender(getSetting("forget_email_sender", "noreply@".$_SERVER['SERVER_NAME']), cb()->getAppName());
82
+            $mail->content("This Is Your New Password", "
83 83
                     Hi $user->name,<br/><br>
84 84
                     Thank you for confirming the request new password. Here is your new password: <br>
85 85
                     <h2>$newPassword</h2>
@@ -90,9 +90,9 @@  discard block
 block discarded – undo
90 90
                 ");
91 91
             $mail->send();
92 92
 
93
-            return cb()->redirect(cb()->getAdminUrl("login"),"We've sent you new password email. Please check at your mail inbox or spambox","success");
93
+            return cb()->redirect(cb()->getAdminUrl("login"), "We've sent you new password email. Please check at your mail inbox or spambox", "success");
94 94
         } else {
95
-            return cb()->redirect(cb()->getAdminUrl("login"),"It looks like the url has been expired!");
95
+            return cb()->redirect(cb()->getAdminUrl("login"), "It looks like the url has been expired!");
96 96
         }
97 97
     }
98 98
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@
 block discarded – undo
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);
Please login to merge, or discard this patch.
src/types/select_table/SelectTable.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
      */
42 42
     public function optionsFromTable($table, $value_option, $display_option, $SQLCondition = null) {
43 43
 
44
-        if(strpos($table,"App\Models")!==false) {
44
+        if (strpos($table, "App\Models") !== false) {
45 45
             $table = new $table();
46 46
             $table = $table::$tableName;
47 47
         }
@@ -50,11 +50,11 @@  discard block
 block discarded – undo
50 50
 
51 51
         $options = [];
52 52
         foreach ($data as $d) {
53
-            $options[ $d->$value_option ] = $d->$display_option;
53
+            $options[$d->$value_option] = $d->$display_option;
54 54
         }
55 55
         $data = columnSingleton()->getColumn($this->index);
56 56
         /** @var $data SelectTableModel */
57
-        $data->setOptionsFromTable(["table"=>$table,"key_field"=>$value_option,"display_field"=>$display_option,"sql_condition"=>$SQLCondition]);
57
+        $data->setOptionsFromTable(["table"=>$table, "key_field"=>$value_option, "display_field"=>$display_option, "sql_condition"=>$SQLCondition]);
58 58
         columnSingleton()->setColumn($this->index, $data);
59 59
 
60 60
         $this->options($options);
Please login to merge, or discard this patch.
src/controllers/SubModuleController.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -14,16 +14,16 @@  discard block
 block discarded – undo
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()) 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");
19 19
 
20
-        if($subModule = Cache::get("subModule".$subModuleKey)) {
20
+        if ($subModule = Cache::get("subModule".$subModuleKey)) {
21 21
             $foreignKey = $subModule['foreignKey'];
22 22
             $foreignValue = $subModule['foreignValue'];
23 23
 
24 24
             $query = $this->repository();
25 25
             $query->where($foreignKey, $foreignValue);
26
-            $result = $query->paginate( request("limit")?:cbConfig("LIMIT_TABLE_DATA") );
26
+            $result = $query->paginate(request("limit") ?: cbConfig("LIMIT_TABLE_DATA"));
27 27
             $data['result'] = $result;
28 28
 
29 29
             $data['additionalHeaderTitle'] = $subModule['parentTitle'];
@@ -33,7 +33,7 @@  discard block
 block discarded – undo
33 33
             return view("crudbooster::module.index.index", array_merge($data, $this->data));
34 34
         }
35 35
 
36
-        return cb()->redirect(module()->url(),"It looks like your url is incorrect");
36
+        return cb()->redirect(module()->url(), "It looks like your url is incorrect");
37 37
     }
38 38
 
39 39
 }
40 40
\ No newline at end of file
Please login to merge, or discard this patch.
Braces   +6 added lines, -2 removed lines patch added patch discarded remove patch
@@ -14,8 +14,12 @@
 block discarded – undo
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'];
Please login to merge, or discard this patch.
src/controllers/CBController.php 2 patches
Spacing   +37 added lines, -37 removed lines patch added patch discarded remove patch
@@ -32,10 +32,10 @@  discard block
 block discarded – undo
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()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
36 36
 
37 37
         $query = $this->repository();
38
-        $result = $query->paginate( request("limit")?:cbConfig("LIMIT_TABLE_DATA") );
38
+        $result = $query->paginate(request("limit") ?: cbConfig("LIMIT_TABLE_DATA"));
39 39
         $data['result'] = $result;
40 40
 
41 41
         return view("crudbooster::module.index.index", array_merge($data, $this->data));
@@ -43,17 +43,17 @@  discard block
 block discarded – undo
43 43
 
44 44
     public function getAdd()
45 45
     {
46
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
46
+        if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
47 47
 
48 48
         $data = [];
49 49
         $data['page_title'] = $this->data['page_title'].' : '.cbLang('add');
50 50
         $data['action_url'] = module()->addSaveURL();
51
-        return view('crudbooster::module.form.form',array_merge($data, $this->data));
51
+        return view('crudbooster::module.form.form', array_merge($data, $this->data));
52 52
     }
53 53
 
54 54
     public function postAddSave()
55 55
     {
56
-        if(!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
56
+        if (!module()->canCreate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
57 57
 
58 58
         try {
59 59
             $this->validation();
@@ -61,38 +61,38 @@  discard block
 block discarded – undo
61 61
             $data = columnSingleton()->getAssignmentData();
62 62
 
63 63
             //Clear data from Primary Key
64
-            unset($data[ cb()->pk($this->data['table']) ]);
64
+            unset($data[cb()->pk($this->data['table'])]);
65 65
 
66
-            if(Schema::hasColumn($this->data['table'], 'created_at')) {
66
+            if (Schema::hasColumn($this->data['table'], 'created_at')) {
67 67
                 $data['created_at'] = date('Y-m-d H:i:s');
68 68
             }
69 69
 
70
-            if(Schema::hasColumn($this->data['table'], 'updated_at')) {
70
+            if (Schema::hasColumn($this->data['table'], 'updated_at')) {
71 71
                 $data['updated_at'] = date('Y-m-d H:i:s');
72 72
             }
73 73
 
74
-            if(isset($this->data['hook_before_insert']) && is_callable($this->data['hook_before_insert'])) {
74
+            if (isset($this->data['hook_before_insert']) && is_callable($this->data['hook_before_insert'])) {
75 75
                 $data = call_user_func($this->data['hook_before_insert'], $data);
76 76
             }
77 77
 
78 78
             $id = DB::table($this->data['table'])->insertGetId($data);
79 79
 
80
-            if(isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) {
80
+            if (isset($this->data['hook_after_insert']) && is_callable($this->data['hook_after_insert'])) {
81 81
                 call_user_func($this->data['hook_after_insert'], $id);
82 82
             }
83 83
 
84 84
         } catch (CBValidationException $e) {
85 85
             Log::debug($e);
86
-            return cb()->redirectBack($e->getMessage(),'info');
86
+            return cb()->redirectBack($e->getMessage(), 'info');
87 87
         } catch (\Exception $e) {
88 88
             Log::error($e);
89
-            return cb()->redirectBack(cbLang("something_went_wrong"),'warning');
89
+            return cb()->redirectBack(cbLang("something_went_wrong"), 'warning');
90 90
         }
91 91
 
92
-        if (Str::contains(request("submit"),cbLang("more"))) {
92
+        if (Str::contains(request("submit"), cbLang("more"))) {
93 93
             return cb()->redirectBack(cbLang("the_data_has_been_added"), 'success');
94 94
         } else {
95
-            if(verifyReferalUrl()) {
95
+            if (verifyReferalUrl()) {
96 96
                 return cb()->redirect(getReferalUrl("url"), cbLang("the_data_has_been_added"), 'success');
97 97
             } else {
98 98
                 return cb()->redirect(module()->url(), cbLang("the_data_has_been_added"), 'success');
@@ -102,7 +102,7 @@  discard block
 block discarded – undo
102 102
 
103 103
     public function getEdit($id)
104 104
     {
105
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
105
+        if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
106 106
 
107 107
         $data = [];
108 108
         $data['row'] = $this->repository()->where($this->data['table'].'.'.getPrimaryKey($this->data['table']), $id)->first();
@@ -113,7 +113,7 @@  discard block
 block discarded – undo
113 113
 
114 114
     public function postEditSave($id)
115 115
     {
116
-        if(!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
116
+        if (!module()->canUpdate()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
117 117
 
118 118
         try {
119 119
             $this->validation();
@@ -121,40 +121,40 @@  discard block
 block discarded – undo
121 121
             $data = columnSingleton()->getAssignmentData();
122 122
 
123 123
             // Make sure the Primary Key is not included
124
-            unset($data[ cb()->pk($this->data['table']) ]);
124
+            unset($data[cb()->pk($this->data['table'])]);
125 125
 
126
-            if(Schema::hasColumn($this->data['table'], 'updated_at')) {
126
+            if (Schema::hasColumn($this->data['table'], 'updated_at')) {
127 127
                 $data['updated_at'] = date('Y-m-d H:i:s');
128 128
             }
129 129
 
130 130
             unset($data['created_at']);
131 131
 
132
-            if(isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) {
132
+            if (isset($this->data['hook_before_update']) && is_callable($this->data['hook_before_update'])) {
133 133
                 $data = call_user_func($this->data['hook_before_update'], $id, $data);
134 134
             }
135 135
 
136 136
             cb()->update($this->data['table'], $id, $data);
137 137
 
138
-            if(isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) {
138
+            if (isset($this->data['hook_after_update']) && is_callable($this->data['hook_after_update'])) {
139 139
                 call_user_func($this->data['hook_after_update'], $id);
140 140
             }
141 141
 
142 142
         } catch (CBValidationException $e) {
143 143
             Log::debug($e);
144
-            return cb()->redirectBack($e->getMessage(),'info');
144
+            return cb()->redirectBack($e->getMessage(), 'info');
145 145
         } catch (\Exception $e) {
146 146
             Log::error($e);
147
-            return cb()->redirectBack(cbLang("something_went_wrong"),'warning');
147
+            return cb()->redirectBack(cbLang("something_went_wrong"), 'warning');
148 148
         }
149 149
 
150 150
 
151 151
         if (Str::contains(request("submit"), cbLang("more"))) {
152
-            return cb()->redirectBack( cbLang("the_data_has_been_updated"), 'success');
152
+            return cb()->redirectBack(cbLang("the_data_has_been_updated"), 'success');
153 153
         } else {
154
-            if(verifyReferalUrl()) {
155
-                return cb()->redirect(getReferalUrl("url"),  cbLang("the_data_has_been_updated"), 'success');
154
+            if (verifyReferalUrl()) {
155
+                return cb()->redirect(getReferalUrl("url"), cbLang("the_data_has_been_updated"), 'success');
156 156
             } else {
157
-                return cb()->redirect(module()->url(),  cbLang("the_data_has_been_updated"), 'success');
157
+                return cb()->redirect(module()->url(), cbLang("the_data_has_been_updated"), 'success');
158 158
             }
159 159
 
160 160
         }
@@ -162,15 +162,15 @@  discard block
 block discarded – undo
162 162
 
163 163
     public function getDelete($id)
164 164
     {
165
-        if(!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
165
+        if (!module()->canDelete()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
166 166
 
167
-        if(isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
167
+        if (isset($this->data['hook_before_delete']) && is_callable($this->data['hook_before_delete'])) {
168 168
             call_user_func($this->data['hook_before_delete'], $id);
169 169
         }
170 170
 
171
-        $softDelete = isset($this->data['disable_soft_delete'])?$this->data['disable_soft_delete']:true;
171
+        $softDelete = isset($this->data['disable_soft_delete']) ? $this->data['disable_soft_delete'] : true;
172 172
 
173
-        if ($softDelete === true && Schema::hasColumn($this->data['table'],'deleted_at')) {
173
+        if ($softDelete === true && Schema::hasColumn($this->data['table'], 'deleted_at')) {
174 174
             DB::table($this->data['table'])
175 175
                 ->where(getPrimaryKey($this->data['table']), $id)
176 176
                 ->update(['deleted_at' => date('Y-m-d H:i:s')]);
@@ -180,16 +180,16 @@  discard block
 block discarded – undo
180 180
                 ->delete();
181 181
         }
182 182
 
183
-        if(isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) {
183
+        if (isset($this->data['hook_after_delete']) && is_callable($this->data['hook_after_delete'])) {
184 184
             call_user_func($this->data['hook_after_delete'], $id);
185 185
         }
186 186
 
187
-        return cb()->redirectBack( cbLang("the_data_has_been_deleted"), 'success');
187
+        return cb()->redirectBack(cbLang("the_data_has_been_deleted"), 'success');
188 188
     }
189 189
 
190 190
     public function getDetail($id)
191 191
     {
192
-        if(!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(),cbLang("you_dont_have_privilege_to_this_area"));
192
+        if (!module()->canRead()) return cb()->redirect(cb()->getAdminUrl(), cbLang("you_dont_have_privilege_to_this_area"));
193 193
 
194 194
         $data = [];
195 195
         $data['row'] = $this->repository()->where($this->data['table'].'.'.cb()->findPrimaryKey($this->data['table']), $id)->first();
@@ -208,14 +208,14 @@  discard block
 block discarded – undo
208 208
      */
209 209
     public function __call($method, $parameters)
210 210
     {
211
-        if($method == "getData") {
211
+        if ($method == "getData") {
212 212
             $key = $parameters[0];
213
-            if(isset($this->data[$key])) {
213
+            if (isset($this->data[$key])) {
214 214
                 return $this->data[$key];
215
-            }else{
215
+            } else {
216 216
                 return null;
217 217
             }
218
-        }else{
218
+        } else {
219 219
             return null;
220 220
         }
221 221
     }
Please login to merge, or discard this patch.
Braces   +23 added lines, -9 removed lines patch added patch discarded remove patch
@@ -32,7 +32,9 @@  discard block
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
 block discarded – undo
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
     }
Please login to merge, or discard this patch.
src/controllers/traits/ColumnIntervention.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -18,14 +18,14 @@
 block discarded – undo
18 18
      */
19 19
     public function columnIntervention()
20 20
     {
21
-        if(request("sub_module") && Cache::has("subModule".request("sub_module")) && cb()->getCurrentMethod() != "getDetail") {
21
+        if (request("sub_module") && Cache::has("subModule".request("sub_module")) && cb()->getCurrentMethod() != "getDetail") {
22 22
             /*
23 23
              * If there is sub module, the column that has same name with foreign key should be remove
24 24
              * And change to hidden. So we can save the foreign Key id from the parent module.
25 25
              */
26 26
             $subModule = Cache::get("subModule".request("sub_module"));
27 27
             $this->removeColumn($subModule["foreignKey"])
28
-                ->addHidden($subModule["foreignKey"],$subModule['foreignKey'])
28
+                ->addHidden($subModule["foreignKey"], $subModule['foreignKey'])
29 29
                 ->defaultValue($subModule['foreignValue']);
30 30
         }
31 31
     }
Please login to merge, or discard this patch.