@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | function uploadImportData($file) |
51 | 51 | { |
52 | 52 | $dir = 'uploads/'.date('Y-m'); |
53 | - $filename = md5(str_random(5)).'.'. $file->getClientOriginalExtension(); |
|
53 | + $filename = md5(str_random(5)).'.'.$file->getClientOriginalExtension(); |
|
54 | 54 | |
55 | 55 | //Create Directory Monthly |
56 | 56 | Storage::makeDirectory($dir); |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | function validateForImport($file) |
69 | 69 | { |
70 | - return Validator::make(['extension' => $file->getClientOriginalExtension(),], ['extension' => 'in:xls,xlsx,csv']); |
|
70 | + return Validator::make(['extension' => $file->getClientOriginalExtension(), ], ['extension' => 'in:xls,xlsx,csv']); |
|
71 | 71 | } |
72 | 72 | |
73 | 73 | |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | |
84 | 84 | $file = base64_decode(request('file')); |
85 | 85 | $file = 'storage'.DIRECTORY_SEPARATOR.'app'.DIRECTORY_SEPARATOR.$file; |
86 | - $rows = Excel::load($file, function ($reader) { |
|
86 | + $rows = Excel::load($file, function($reader) { |
|
87 | 87 | })->get(); |
88 | 88 | |
89 | 89 | //$data_import_column = []; |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | foreach ($select_column as $sk => $s) { |
93 | 93 | $colname = $table_columns[$sk]; |
94 | 94 | |
95 | - if (! CRUDBooster::isForeignKey($colname) || intval($value->$s)) { |
|
95 | + if (!CRUDBooster::isForeignKey($colname) || intval($value->$s)) { |
|
96 | 96 | $a[$colname] = $value->$s; |
97 | 97 | continue; |
98 | 98 | } |
@@ -106,7 +106,7 @@ discard block |
||
106 | 106 | $relation_moduls = DB::table('cms_moduls')->where('table_name', $relation_table)->first(); |
107 | 107 | |
108 | 108 | $relation_class = __NAMESPACE__.'\\'.$relation_moduls->controller; |
109 | - if (! class_exists($relation_class)) { |
|
109 | + if (!class_exists($relation_class)) { |
|
110 | 110 | $relation_class = '\App\Http\Controllers\\'.$relation_moduls->controller; |
111 | 111 | } |
112 | 112 | $relation_class = new $relation_class; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | */ |
60 | 60 | private function guardView($request) |
61 | 61 | { |
62 | - if ($request->is($this->url.'*') && ! CRUDBooster::canView()) { |
|
62 | + if ($request->is($this->url.'*') && !CRUDBooster::canView()) { |
|
63 | 63 | $this->stopIllegalAction('view'); |
64 | 64 | } |
65 | 65 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | */ |
70 | 70 | private function guardCreate($request) |
71 | 71 | { |
72 | - if ($request->is($this->url.'/add*') && ! CRUDBooster::canCreate()) { |
|
72 | + if ($request->is($this->url.'/add*') && !CRUDBooster::canCreate()) { |
|
73 | 73 | $this->stopIllegalAction('add'); |
74 | 74 | } |
75 | 75 | } |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | */ |
80 | 80 | private function guardUpdate($request) |
81 | 81 | { |
82 | - if ($request->is($this->url.'/edit*') && ! CRUDBooster::canUpdate()) { |
|
82 | + if ($request->is($this->url.'/edit*') && !CRUDBooster::canUpdate()) { |
|
83 | 83 | $this->stopIllegalAction('edit'); |
84 | 84 | } |
85 | 85 | } |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | */ |
90 | 90 | private function guardDelete($request) |
91 | 91 | { |
92 | - if ($request->is($this->url.'/delete*') && ! CRUDBooster::canDelete()) { |
|
92 | + if ($request->is($this->url.'/delete*') && !CRUDBooster::canDelete()) { |
|
93 | 93 | $this->stopIllegalAction('delete'); |
94 | 94 | } |
95 | 95 | } |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | */ |
100 | 100 | private function guardRead($request) |
101 | 101 | { |
102 | - if ($request->is($this->url.'/detail*') && ! CRUDBooster::canRead()) { |
|
102 | + if ($request->is($this->url.'/detail*') && !CRUDBooster::canRead()) { |
|
103 | 103 | $this->stopIllegalAction('view'); |
104 | 104 | } |
105 | 105 | } |
@@ -116,7 +116,7 @@ |
||
116 | 116 | */ |
117 | 117 | private function tokenMissMatchDevice($senderToken, $userAgent, $serverToken) |
118 | 118 | { |
119 | - if (! Cache::has($senderToken) || Cache::get($senderToken) == $userAgent) { |
|
119 | + if (!Cache::has($senderToken) || Cache::get($senderToken) == $userAgent) { |
|
120 | 120 | return; |
121 | 121 | } |
122 | 122 | $result = []; |
@@ -19,16 +19,16 @@ |
||
19 | 19 | { |
20 | 20 | $adminPath = cbConfig('ADMIN_PATH', 'admin'); |
21 | 21 | |
22 | - if(CRUDBooster::myId()==''){ |
|
22 | + if (CRUDBooster::myId() == '') { |
|
23 | 23 | $url = url($adminPath.'/login'); |
24 | 24 | return redirect($url)->with('message', cbTrans('not_logged_in')); |
25 | 25 | } |
26 | 26 | |
27 | - if(!CRUDBooster::isSuperadmin()) { |
|
28 | - return redirect($adminPath)->with(['message'=> cbTrans('denied_access'),'message_type'=>'warning']); |
|
27 | + if (!CRUDBooster::isSuperadmin()) { |
|
28 | + return redirect($adminPath)->with(['message'=> cbTrans('denied_access'), 'message_type'=>'warning']); |
|
29 | 29 | } |
30 | 30 | |
31 | - if(CRUDBooster::isLocked()){ |
|
31 | + if (CRUDBooster::isLocked()) { |
|
32 | 32 | return redirect(url($adminPath.'/lock-screen')); |
33 | 33 | } |
34 | 34 |
@@ -10,7 +10,7 @@ |
||
10 | 10 | |
11 | 11 | public function send($regID, $data) |
12 | 12 | { |
13 | - if (! $data['title'] || ! $data['content']) { |
|
13 | + if (!$data['title'] || !$data['content']) { |
|
14 | 14 | return 'title , content null !'; |
15 | 15 | } |
16 | 16 |
@@ -47,7 +47,6 @@ |
||
47 | 47 | * @param $template |
48 | 48 | * @param $subject |
49 | 49 | * @param $html |
50 | - |
|
51 | 50 | * @return bool |
52 | 51 | */ |
53 | 52 | private function putInQueue($config, $template, $subject, $html) |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | */ |
77 | 77 | private function sendMail($html, $subject, $template) |
78 | 78 | { |
79 | - \Mail::send("crudbooster::emails.blank", ['content' => $html], function ($message) use ($subject, $template) { |
|
79 | + \Mail::send("crudbooster::emails.blank", ['content' => $html], function($message) use ($subject, $template) { |
|
80 | 80 | $message->priority(1); |
81 | 81 | $message->to($this->reciever); |
82 | 82 | |
@@ -105,7 +105,7 @@ discard block |
||
105 | 105 | |
106 | 106 | $attachments = unserialize($queue->email_attachments); |
107 | 107 | |
108 | - \Mail::send("crudbooster::emails.blank", ['content' => $queue->email_content], function ($message) use ( |
|
108 | + \Mail::send("crudbooster::emails.blank", ['content' => $queue->email_content], function($message) use ( |
|
109 | 109 | $queue, |
110 | 110 | $attachments |
111 | 111 | ) { |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public static function myPrivilege() |
75 | 75 | { |
76 | 76 | $roles = session('admin_privileges_roles'); |
77 | - if (! $roles) { |
|
77 | + if (!$roles) { |
|
78 | 78 | return; |
79 | 79 | } |
80 | 80 | foreach ($roles as $role) { |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | |
87 | 87 | private static function getModulePath() |
88 | 88 | { |
89 | - $adminPathSegments = count(explode('/',cbConfig('ADMIN_PATH'))); |
|
89 | + $adminPathSegments = count(explode('/', cbConfig('ADMIN_PATH'))); |
|
90 | 90 | return Request::segment(1 + $adminPathSegments); |
91 | 91 | } |
92 | 92 | |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | } |
278 | 278 | } |
279 | 279 | |
280 | - if (! $full) { |
|
280 | + if (!$full) { |
|
281 | 281 | $string = array_slice($string, 0, 1); |
282 | 282 | } |
283 | 283 | |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | public static function first($table, $id) |
298 | 298 | { |
299 | 299 | $table = self::parseSqlTable($table)['table']; |
300 | - if (! is_array($id)) { |
|
300 | + if (!is_array($id)) { |
|
301 | 301 | $pk = self::pk($table); |
302 | 302 | |
303 | 303 | return DB::table($table)->where($pk, $id)->first(); |
@@ -430,7 +430,7 @@ discard block |
||
430 | 430 | $controllerName = basename($controllerName); |
431 | 431 | $route_url = route($controllerName.'GetIndex'); |
432 | 432 | |
433 | - if (! $path) { |
|
433 | + if (!$path) { |
|
434 | 434 | return trim($route_url, '/'); |
435 | 435 | } |
436 | 436 | |
@@ -490,7 +490,7 @@ discard block |
||
490 | 490 | @$get = $_GET; |
491 | 491 | $inputhtml = ''; |
492 | 492 | |
493 | - if (! $get) { |
|
493 | + if (!$get) { |
|
494 | 494 | return $inputhtml; |
495 | 495 | } |
496 | 496 | if (is_array($exception)) { |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | */ |
16 | 16 | public static function findPK($table) |
17 | 17 | { |
18 | - if (! $table) { |
|
18 | + if (!$table) { |
|
19 | 19 | return 'id'; |
20 | 20 | } |
21 | 21 | |
@@ -24,13 +24,13 @@ discard block |
||
24 | 24 | } |
25 | 25 | $table = CRUDBooster::parseSqlTable($table); |
26 | 26 | |
27 | - if (! $table['table']) { |
|
27 | + if (!$table['table']) { |
|
28 | 28 | throw new \Exception("parseSqlTable can't determine the table"); |
29 | 29 | } |
30 | 30 | |
31 | 31 | $primary_key = self::findPKname($table); |
32 | 32 | |
33 | - if (! $primary_key) { |
|
33 | + if (!$primary_key) { |
|
34 | 34 | return 'id'; |
35 | 35 | } |
36 | 36 | CRUDBooster::putCache('table_'.$table, 'primary_key', $primary_key); |
@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | $cols = collect(DB::select('SELECT * FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = :database AND TABLE_NAME = :table', [ |
101 | 101 | 'database' => $table['database'], |
102 | 102 | 'table' => $table['table'], |
103 | - ]))->map(function ($x) { |
|
103 | + ]))->map(function($x) { |
|
104 | 104 | return (array) $x; |
105 | 105 | })->toArray(); |
106 | 106 | |
@@ -114,10 +114,10 @@ discard block |
||
114 | 114 | */ |
115 | 115 | public static function colExists($table, $field) |
116 | 116 | { |
117 | - if (! $table) { |
|
117 | + if (!$table) { |
|
118 | 118 | throw new Exception("\$table is empty !", 1); |
119 | 119 | } |
120 | - if (! $field) { |
|
120 | + if (!$field) { |
|
121 | 121 | throw new Exception("\$field is empty !", 1); |
122 | 122 | } |
123 | 123 | |
@@ -153,7 +153,7 @@ discard block |
||
153 | 153 | { |
154 | 154 | $field = 'field_type_'.$table.'_'.$field; |
155 | 155 | |
156 | - return Cache::rememberForever($field, function () use ($table, $field) { |
|
156 | + return Cache::rememberForever($field, function() use ($table, $field) { |
|
157 | 157 | try { |
158 | 158 | //MySQL & SQL Server |
159 | 159 | $typedata = DB::select(DB::raw("select DATA_TYPE from INFORMATION_SCHEMA.COLUMNS where TABLE_NAME='$table' and COLUMN_NAME = '$field'"))[0]->DATA_TYPE; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | } |
179 | 179 | |
180 | 180 | $table = CRUDBooster::getTableForeignKey($fieldName); |
181 | - if (! $table) { |
|
181 | + if (!$table) { |
|
182 | 182 | return false; |
183 | 183 | } |
184 | 184 |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | { |
9 | 9 | public static function get($section, $cacheName) |
10 | 10 | { |
11 | - if (! CacheFacade::has($section)) { |
|
11 | + if (!CacheFacade::has($section)) { |
|
12 | 12 | return false; |
13 | 13 | } |
14 | 14 | $cacheOpen = CacheFacade::get($section); |
@@ -32,7 +32,7 @@ discard block |
||
32 | 32 | |
33 | 33 | public static function forgetCache($section, $cache_name) |
34 | 34 | { |
35 | - if (! CacheFacade::has($section)) { |
|
35 | + if (!CacheFacade::has($section)) { |
|
36 | 36 | return false; |
37 | 37 | } |
38 | 38 | $open = CacheFacade::get($section); |