@@ -1,5 +1,5 @@ |
||
1 | 1 | <?php |
2 | 2 | |
3 | -cb()->routeGroupBackend(function () { |
|
4 | - cb()->routePost("select-table-lookup",'\crocodicstudio\crudbooster\types\select_table\SelectTableController@postLookup'); |
|
3 | +cb()->routeGroupBackend(function() { |
|
4 | + cb()->routePost("select-table-lookup", '\crocodicstudio\crudbooster\types\select_table\SelectTableController@postLookup'); |
|
5 | 5 | }); |
6 | 6 | \ No newline at end of file |
@@ -8,7 +8,7 @@ |
||
8 | 8 | <option value="">** Select a {{ $column->getLabel() }}</option> |
9 | 9 | @if(!$column->getForeignKey()) |
10 | 10 | <?php |
11 | - $columnValue = old($column->getName())?:($column->getDefaultValue())?:$column->getValue(); |
|
11 | + $columnValue = old($column->getName()) ?: ($column->getDefaultValue()) ?: $column->getValue(); |
|
12 | 12 | ?> |
13 | 13 | @foreach($column->getOptions() as $key=>$value) |
14 | 14 | <option {{ $columnValue==$key?'selected':'' }} value="{{ $key }}">{{ $value }}</option> |
@@ -41,13 +41,13 @@ discard block |
||
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 | } |
48 | 48 | |
49 | 49 | $data = DB::table($table); |
50 | - if($SQLCondition && is_callable($SQLCondition)) { |
|
50 | + if ($SQLCondition && is_callable($SQLCondition)) { |
|
51 | 51 | $data = call_user_func($SQLCondition, $data); |
52 | 52 | }elseif ($SQLCondition && is_string($SQLCondition)) { |
53 | 53 | $data->whereRaw($SQLCondition); |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | $data = $data->get(); |
56 | 56 | $options = []; |
57 | 57 | foreach ($data as $d) { |
58 | - $options[ $d->$value_option ] = $d->$display_option; |
|
58 | + $options[$d->$value_option] = $d->$display_option; |
|
59 | 59 | } |
60 | 60 | $data = columnSingleton()->getColumn($this->index); |
61 | 61 | /** @var $data SelectTableModel */ |
62 | - $data->setOptionsFromTable(["table"=>$table,"key_field"=>$value_option,"display_field"=>$display_option,"sql_condition"=>$SQLCondition]); |
|
62 | + $data->setOptionsFromTable(["table"=>$table, "key_field"=>$value_option, "display_field"=>$display_option, "sql_condition"=>$SQLCondition]); |
|
63 | 63 | columnSingleton()->setColumn($this->index, $data); |
64 | 64 | |
65 | 65 | $this->options($options); |
@@ -36,7 +36,7 @@ |
||
36 | 36 | $data = DB::table($table); |
37 | 37 | if($SQLCondition && is_callable($SQLCondition)) { |
38 | 38 | $data = call_user_func($SQLCondition, $data); |
39 | - }elseif ($SQLCondition && is_string($SQLCondition)) { |
|
39 | + } elseif ($SQLCondition && is_string($SQLCondition)) { |
|
40 | 40 | $data->whereRaw($SQLCondition); |
41 | 41 | } |
42 | 42 | $data = $data->get(); |
@@ -19,9 +19,9 @@ discard block |
||
19 | 19 | */ |
20 | 20 | public function query($query, $column) |
21 | 21 | { |
22 | - if($column->getOptionsFromTable()) { |
|
22 | + if ($column->getOptionsFromTable()) { |
|
23 | 23 | $option = $column->getOptionsFromTable(); |
24 | - $query->leftjoin($option["table"],$option["table"].'.'.$option["key_field"],"=", $column->getName()); |
|
24 | + $query->leftjoin($option["table"], $option["table"].'.'.$option["key_field"], "=", $column->getName()); |
|
25 | 25 | $query->addSelect($option['table'].'.'.$option['display_field'].' as '.$option['table'].'_'.$option['display_field']); |
26 | 26 | } |
27 | 27 | return $query; |
@@ -33,13 +33,13 @@ discard block |
||
33 | 33 | */ |
34 | 34 | public function indexRender($row, $column) |
35 | 35 | { |
36 | - if($column->getOptionsFromTable()) { |
|
36 | + if ($column->getOptionsFromTable()) { |
|
37 | 37 | $option = $column->getOptionsFromTable(); |
38 | 38 | return $row->{ $option['table'].'_'.$option['display_field'] }; |
39 | - }else{ |
|
39 | + } else { |
|
40 | 40 | $option = $column->getOptions(); |
41 | 41 | $key = $row->{ $column->getField() }; |
42 | - return @$option[ $key ]; |
|
42 | + return @$option[$key]; |
|
43 | 43 | } |
44 | 44 | } |
45 | 45 |
@@ -36,7 +36,7 @@ |
||
36 | 36 | if($column->getOptionsFromTable()) { |
37 | 37 | $option = $column->getOptionsFromTable(); |
38 | 38 | return $row->{ $option['table'].'_'.$option['display_field'] }; |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | $option = $column->getOptions(); |
41 | 41 | $key = $row->{ $column->getField() }; |
42 | 42 | return @$option[ $key ]; |
@@ -18,11 +18,11 @@ discard block |
||
18 | 18 | $foreignValue = request('foreign_value'); |
19 | 19 | $table = decrypt(request('table')); |
20 | 20 | $sqlCondition = decrypt(request('sql_condition')); |
21 | - if($foreignKey && $foreignValue && $table) { |
|
21 | + if ($foreignKey && $foreignValue && $table) { |
|
22 | 22 | |
23 | 23 | $data = DB::table($table) |
24 | 24 | ->where($foreignKey, $foreignValue); |
25 | - if($sqlCondition) { |
|
25 | + if ($sqlCondition) { |
|
26 | 26 | $data->whereRaw($sqlCondition); |
27 | 27 | } |
28 | 28 | |
@@ -30,7 +30,7 @@ discard block |
||
30 | 30 | |
31 | 31 | return response()->json(['status'=>true, 'data'=>$data], 200, ["X-Frame-Options"=>"SAMEORIGIN"]); |
32 | 32 | |
33 | - }else{ |
|
33 | + } else { |
|
34 | 34 | return response()->json(['status'=>false]); |
35 | 35 | } |
36 | 36 | } |
@@ -30,7 +30,7 @@ |
||
30 | 30 | |
31 | 31 | return response()->json(['status'=>true, 'data'=>$data], 200, ["X-Frame-Options"=>"SAMEORIGIN"]); |
32 | 32 | |
33 | - }else{ |
|
33 | + } else{ |
|
34 | 34 | return response()->json(['status'=>false]); |
35 | 35 | } |
36 | 36 | } |
@@ -7,7 +7,7 @@ |
||
7 | 7 | name="{{ $column->getName() }}" id="{{ $column->getName() }}"> |
8 | 8 | <option value="">** Select a {{ $column->getLabel() }}</option> |
9 | 9 | <?php |
10 | - $columnValue = old($column->getName())?:($column->getDefaultValue())?:$column->getValue(); |
|
10 | + $columnValue = old($column->getName()) ?: ($column->getDefaultValue()) ?: $column->getValue(); |
|
11 | 11 | ?> |
12 | 12 | @foreach($column->getOptions() as $key=>$value) |
13 | 13 | <option {{ $columnValue==$key?'selected':'' }} value="{{ $key }}">{{ $value }}</option> |
@@ -29,16 +29,16 @@ |
||
29 | 29 | |
30 | 30 | columnSingleton()->setColumn($this->index, $data); |
31 | 31 | |
32 | - if(is_callable($query)) { |
|
32 | + if (is_callable($query)) { |
|
33 | 33 | $result = call_user_func($query); |
34 | - }else{ |
|
34 | + } else { |
|
35 | 35 | $result = DB::select(DB::raw($query)); |
36 | 36 | } |
37 | 37 | |
38 | - if($result) { |
|
38 | + if ($result) { |
|
39 | 39 | $options = []; |
40 | - foreach($result as $r) { |
|
41 | - $options[ $r->key ] = $r->label; |
|
40 | + foreach ($result as $r) { |
|
41 | + $options[$r->key] = $r->label; |
|
42 | 42 | } |
43 | 43 | $this->options($options); |
44 | 44 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | |
32 | 32 | if(is_callable($query)) { |
33 | 33 | $result = call_user_func($query); |
34 | - }else{ |
|
34 | + } else{ |
|
35 | 35 | $result = DB::select(DB::raw($query)); |
36 | 36 | } |
37 | 37 |
@@ -18,8 +18,8 @@ |
||
18 | 18 | */ |
19 | 19 | public function handle($request, Closure $next) |
20 | 20 | { |
21 | - if(auth()->guest()) { |
|
22 | - return cb()->redirect(cb()->getLoginUrl("login"),trans('cb::cb.please_login_for_first'),'warning'); |
|
21 | + if (auth()->guest()) { |
|
22 | + return cb()->redirect(cb()->getLoginUrl("login"), trans('cb::cb.please_login_for_first'), 'warning'); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | (new CBHook())->beforeBackendMiddleware($request); |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | if ($this->confirm('Do you have setting the database configuration at .env ?')) { |
41 | 41 | |
42 | - if (! file_exists(public_path('vendor')) ) { |
|
42 | + if (!file_exists(public_path('vendor'))) { |
|
43 | 43 | mkdir(public_path('vendor')); |
44 | 44 | } |
45 | 45 | |
@@ -54,11 +54,11 @@ discard block |
||
54 | 54 | * We need it to change default laravel local filesystem from storage to public |
55 | 55 | * We won't use symlink because of a security issue in many server |
56 | 56 | */ |
57 | - if(!file_exists(public_path("storage"))) { |
|
57 | + if (!file_exists(public_path("storage"))) { |
|
58 | 58 | $this->info("Create storage directory on /public"); |
59 | 59 | mkdir(public_path("storage")); |
60 | - file_put_contents(public_path("storage/.gitignore"),"!.gitignore"); |
|
61 | - file_put_contents(public_path("storage/index.html")," "); |
|
60 | + file_put_contents(public_path("storage/.gitignore"), "!.gitignore"); |
|
61 | + file_put_contents(public_path("storage/index.html"), " "); |
|
62 | 62 | } |
63 | 63 | |
64 | 64 | /* |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | * Disable php execution on /vendor/* |
68 | 68 | */ |
69 | 69 | $this->info("Tweak some security for your laravel"); |
70 | - file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND); |
|
71 | - file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>",FILE_APPEND); |
|
70 | + file_put_contents(base_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND); |
|
71 | + file_put_contents(public_path(".htaccess"), "\n\n# Generated by CRUDBooster\nServerSignature Off\nIndexIgnore *\nRewriteRule ^(.*)/vendor/.*\.(php|rb|py)$ - [F,L,NC]\nRewriteRule ^vendor/.*\.(php|rb|py)$ - [F,L,NC]\n<FilesMatch \"^\.\">\nOrder allow,deny\nDeny from all\n</FilesMatch>", FILE_APPEND); |
|
72 | 72 | |
73 | 73 | |
74 | 74 | $this->info('Dumping the autoloaded files and reloading all new files...'); |