@@ -22,7 +22,7 @@ |
||
22 | 22 | public function indexRender($row, $column) |
23 | 23 | { |
24 | 24 | $value = trim(strip_tags($row->{ $column->getField() })); |
25 | - if($column->getLimit()) { |
|
25 | + if ($column->getLimit()) { |
|
26 | 26 | $value = Str::limit($value, $column->getLimit()); |
27 | 27 | } |
28 | 28 | return $value; |
@@ -21,16 +21,16 @@ |
||
21 | 21 | */ |
22 | 22 | public function assignment($value, $column) |
23 | 23 | { |
24 | - $value = str_replace($column->getThousands()?:",","", $value); |
|
25 | - $value = str_replace($column->getDecimal()?:".",".",$value); |
|
24 | + $value = str_replace($column->getThousands() ?: ",", "", $value); |
|
25 | + $value = str_replace($column->getDecimal() ?: ".", ".", $value); |
|
26 | 26 | return $value; |
27 | 27 | } |
28 | 28 | |
29 | 29 | public function indexRender($row, $column) |
30 | 30 | { |
31 | 31 | $value = $row->{$column->getField()}; |
32 | - $prefix = ($column->getPrefix())?:""; |
|
33 | - return $prefix.number_format($value, $column->getPrecision()?:0, $column->getDecimal()?:".", $column->getThousands()?:","); |
|
32 | + $prefix = ($column->getPrefix()) ?: ""; |
|
33 | + return $prefix.number_format($value, $column->getPrecision() ?: 0, $column->getDecimal() ?: ".", $column->getThousands() ?: ","); |
|
34 | 34 | } |
35 | 35 | |
36 | 36 | public function detailRender($row, $column) |
@@ -42,17 +42,17 @@ discard block |
||
42 | 42 | public function valueAssignment($data_row = null) { |
43 | 43 | foreach ($this->getColumns() as $index=>$column) { |
44 | 44 | |
45 | - if (! $column->getName()) { |
|
45 | + if (!$column->getName()) { |
|
46 | 46 | continue; |
47 | 47 | } |
48 | 48 | |
49 | 49 | /** @var ColumnModel $column */ |
50 | - if($data_row) { |
|
51 | - $value = (isset($data_row->{$column->getField()}))?$data_row->{ $column->getField() }:null; |
|
52 | - }else{ |
|
50 | + if ($data_row) { |
|
51 | + $value = (isset($data_row->{$column->getField()})) ? $data_row->{ $column->getField() }:null; |
|
52 | + } else { |
|
53 | 53 | $value = request($column->getName()); |
54 | 54 | |
55 | - if(!$value && $column->getDefaultValue()) { |
|
55 | + if (!$value && $column->getDefaultValue()) { |
|
56 | 56 | $value = $column->getDefaultValue(); |
57 | 57 | } |
58 | 58 | |
@@ -68,9 +68,9 @@ discard block |
||
68 | 68 | { |
69 | 69 | $data = $this->columns; |
70 | 70 | $newData = []; |
71 | - foreach($data as $i=>$item) { |
|
71 | + foreach ($data as $i=>$item) { |
|
72 | 72 | /** @var ColumnModel $item */ |
73 | - if($item->getShowIndex()) { |
|
73 | + if ($item->getShowIndex()) { |
|
74 | 74 | $newData[] = $item; |
75 | 75 | } |
76 | 76 | } |
@@ -81,9 +81,9 @@ discard block |
||
81 | 81 | { |
82 | 82 | $data = $this->columns; |
83 | 83 | $newData = []; |
84 | - foreach($data as $i=>$item) { |
|
84 | + foreach ($data as $i=>$item) { |
|
85 | 85 | /** @var ColumnModel $item */ |
86 | - if($item->getShowAdd() || $item->getShowEdit()) { |
|
86 | + if ($item->getShowAdd() || $item->getShowEdit()) { |
|
87 | 87 | $newData[] = $item; |
88 | 88 | } |
89 | 89 | } |
@@ -94,9 +94,9 @@ discard block |
||
94 | 94 | { |
95 | 95 | $data = $this->columns; |
96 | 96 | $newData = []; |
97 | - foreach($data as $i=>$item) { |
|
97 | + foreach ($data as $i=>$item) { |
|
98 | 98 | /** @var ColumnModel $item */ |
99 | - if($item->getShowEdit()) { |
|
99 | + if ($item->getShowEdit()) { |
|
100 | 100 | $newData[] = $item; |
101 | 101 | } |
102 | 102 | } |
@@ -107,9 +107,9 @@ discard block |
||
107 | 107 | { |
108 | 108 | $data = $this->columns; |
109 | 109 | $newData = []; |
110 | - foreach($data as $i=>$item) { |
|
110 | + foreach ($data as $i=>$item) { |
|
111 | 111 | /** @var ColumnModel $item */ |
112 | - if($item->getShowAdd()) { |
|
112 | + if ($item->getShowAdd()) { |
|
113 | 113 | $newData[] = $item; |
114 | 114 | } |
115 | 115 | } |
@@ -120,9 +120,9 @@ discard block |
||
120 | 120 | { |
121 | 121 | $data = $this->columns; |
122 | 122 | $newData = []; |
123 | - foreach($data as $i=>$item) { |
|
123 | + foreach ($data as $i=>$item) { |
|
124 | 124 | /** @var ColumnModel $item */ |
125 | - if($item->getShowDetail()) { |
|
125 | + if ($item->getShowDetail()) { |
|
126 | 126 | $newData[] = $item; |
127 | 127 | } |
128 | 128 | } |
@@ -132,14 +132,14 @@ discard block |
||
132 | 132 | public function getAssignmentData() |
133 | 133 | { |
134 | 134 | $data = []; |
135 | - foreach($this->columns as $column) { |
|
135 | + foreach ($this->columns as $column) { |
|
136 | 136 | /** @var ColumnModel $column */ |
137 | 137 | |
138 | - if(is_array($column->getValue())) { |
|
139 | - foreach($column->getValue() as $key=>$val) { |
|
138 | + if (is_array($column->getValue())) { |
|
139 | + foreach ($column->getValue() as $key=>$val) { |
|
140 | 140 | $data[$key] = $val; |
141 | 141 | } |
142 | - }else{ |
|
142 | + } else { |
|
143 | 143 | $data[$column->getField()] = $column->getValue(); |
144 | 144 | } |
145 | 145 | } |
@@ -149,10 +149,10 @@ discard block |
||
149 | 149 | public function removeColumn($label_or_name) |
150 | 150 | { |
151 | 151 | $data = $this->getColumns(); |
152 | - foreach($data as $i=>$d) |
|
152 | + foreach ($data as $i=>$d) |
|
153 | 153 | { |
154 | 154 | /** @var ColumnModel $d */ |
155 | - if($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) { |
|
155 | + if ($d->getLabel() == $label_or_name || $d->getName() == $label_or_name) { |
|
156 | 156 | unset($data[$i]); |
157 | 157 | } |
158 | 158 | } |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | public function getColumnNameOnly() |
163 | 163 | { |
164 | 164 | $result = []; |
165 | - foreach($this->columns as $column) { |
|
165 | + foreach ($this->columns as $column) { |
|
166 | 166 | /** @var ColumnModel $column */ |
167 | 167 | $result[] = $column->getName(); |
168 | 168 | } |
@@ -49,7 +49,7 @@ discard block |
||
49 | 49 | /** @var ColumnModel $column */ |
50 | 50 | if($data_row) { |
51 | 51 | $value = (isset($data_row->{$column->getField()}))?$data_row->{ $column->getField() }:null; |
52 | - }else{ |
|
52 | + } else{ |
|
53 | 53 | $value = request($column->getName()); |
54 | 54 | |
55 | 55 | if(!$value && $column->getDefaultValue()) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | foreach($column->getValue() as $key=>$val) { |
140 | 140 | $data[$key] = $val; |
141 | 141 | } |
142 | - }else{ |
|
142 | + } else{ |
|
143 | 143 | $data[$column->getField()] = $column->getValue(); |
144 | 144 | } |
145 | 145 | } |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | private function name($label, $name = null) |
20 | 20 | { |
21 | - return (!$name)?strtolower(slug($label,"_")):$name; |
|
21 | + return (!$name) ?strtolower(slug($label, "_")) : $name; |
|
22 | 22 | } |
23 | 23 | |
24 | 24 | /** |
@@ -39,8 +39,8 @@ discard block |
||
39 | 39 | $model->setShowAdd(true); |
40 | 40 | $model->setShowEdit(true); |
41 | 41 | $model->setShowDetail(true); |
42 | - $model->setIndexDisplayTransform(function ($value, $row) { return $value; }); |
|
43 | - $model->setDetailDisplayTransform(function ($value, $row) { return $value; }); |
|
42 | + $model->setIndexDisplayTransform(function($value, $row) { return $value; }); |
|
43 | + $model->setDetailDisplayTransform(function($value, $row) { return $value; }); |
|
44 | 44 | return $model; |
45 | 45 | } |
46 | 46 |
@@ -26,12 +26,12 @@ |
||
26 | 26 | |
27 | 27 | public function indexRender($row, $column) |
28 | 28 | { |
29 | - return (isset($row->{$column->getField()}))?$row->{ $column->getField() }:null; |
|
29 | + return (isset($row->{$column->getField()})) ? $row->{ $column->getField() }:null; |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | public function detailRender($row, $column) |
33 | 33 | { |
34 | - return (isset($row->{$column->getField()}))?$row->{ $column->getField() }:null; |
|
34 | + return (isset($row->{$column->getField()})) ? $row->{ $column->getField() }:null; |
|
35 | 35 | } |
36 | 36 | |
37 | 37 | /** |
@@ -149,21 +149,21 @@ |
||
149 | 149 | <?php |
150 | 150 | $font = new \crocodicstudio\crudbooster\helpers\FontAwesome(); |
151 | 151 | $fontData = [ |
152 | - ["data"=>$font->text(),"label"=>"Text"], |
|
153 | - ["data"=>$font->web(),"label"=>"Web"], |
|
154 | - ["data"=>$font->video(),"label"=>"Video"], |
|
155 | - ["data"=>$font->transportation(),"label"=>"Transportation"], |
|
156 | - ["data"=>$font->payment(),"label"=>"Payment"], |
|
157 | - ["data"=>$font->medical(),"label"=>"Medical"], |
|
158 | - ["data"=>$font->hand(),"label"=>"Hand"], |
|
159 | - ["data"=>$font->fileType(),"label"=>"File Type"], |
|
160 | - ["data"=>$font->directional(),"label"=>"Directional"], |
|
161 | - ["data"=>$font->currency(),"label"=>"Currency"], |
|
162 | - ["data"=>$font->chart(),"label"=>"Chart"], |
|
163 | - ["data"=>$font->brands(),"label"=>"Brand"], |
|
164 | - ["data"=>$font->gender(),"label"=>"Gender"], |
|
165 | - ["data"=>$font->form(),"label"=>"Form"], |
|
166 | - ["data"=>$font->spinner(),"label"=>"Spinner"] |
|
152 | + ["data"=>$font->text(), "label"=>"Text"], |
|
153 | + ["data"=>$font->web(), "label"=>"Web"], |
|
154 | + ["data"=>$font->video(), "label"=>"Video"], |
|
155 | + ["data"=>$font->transportation(), "label"=>"Transportation"], |
|
156 | + ["data"=>$font->payment(), "label"=>"Payment"], |
|
157 | + ["data"=>$font->medical(), "label"=>"Medical"], |
|
158 | + ["data"=>$font->hand(), "label"=>"Hand"], |
|
159 | + ["data"=>$font->fileType(), "label"=>"File Type"], |
|
160 | + ["data"=>$font->directional(), "label"=>"Directional"], |
|
161 | + ["data"=>$font->currency(), "label"=>"Currency"], |
|
162 | + ["data"=>$font->chart(), "label"=>"Chart"], |
|
163 | + ["data"=>$font->brands(), "label"=>"Brand"], |
|
164 | + ["data"=>$font->gender(), "label"=>"Gender"], |
|
165 | + ["data"=>$font->form(), "label"=>"Form"], |
|
166 | + ["data"=>$font->spinner(), "label"=>"Spinner"] |
|
167 | 167 | ]; |
168 | 168 | ?> |
169 | 169 | @foreach($fontData as $f) |
@@ -149,21 +149,21 @@ |
||
149 | 149 | <?php |
150 | 150 | $font = new \crocodicstudio\crudbooster\helpers\FontAwesome(); |
151 | 151 | $fontData = [ |
152 | - ["data"=>$font->text(),"label"=>"Text"], |
|
153 | - ["data"=>$font->web(),"label"=>"Web"], |
|
154 | - ["data"=>$font->video(),"label"=>"Video"], |
|
155 | - ["data"=>$font->transportation(),"label"=>"Transportation"], |
|
156 | - ["data"=>$font->payment(),"label"=>"Payment"], |
|
157 | - ["data"=>$font->medical(),"label"=>"Medical"], |
|
158 | - ["data"=>$font->hand(),"label"=>"Hand"], |
|
159 | - ["data"=>$font->fileType(),"label"=>"File Type"], |
|
160 | - ["data"=>$font->directional(),"label"=>"Directional"], |
|
161 | - ["data"=>$font->currency(),"label"=>"Currency"], |
|
162 | - ["data"=>$font->chart(),"label"=>"Chart"], |
|
163 | - ["data"=>$font->brands(),"label"=>"Brand"], |
|
164 | - ["data"=>$font->gender(),"label"=>"Gender"], |
|
165 | - ["data"=>$font->form(),"label"=>"Form"], |
|
166 | - ["data"=>$font->spinner(),"label"=>"Spinner"] |
|
152 | + ["data"=>$font->text(), "label"=>"Text"], |
|
153 | + ["data"=>$font->web(), "label"=>"Web"], |
|
154 | + ["data"=>$font->video(), "label"=>"Video"], |
|
155 | + ["data"=>$font->transportation(), "label"=>"Transportation"], |
|
156 | + ["data"=>$font->payment(), "label"=>"Payment"], |
|
157 | + ["data"=>$font->medical(), "label"=>"Medical"], |
|
158 | + ["data"=>$font->hand(), "label"=>"Hand"], |
|
159 | + ["data"=>$font->fileType(), "label"=>"File Type"], |
|
160 | + ["data"=>$font->directional(), "label"=>"Directional"], |
|
161 | + ["data"=>$font->currency(), "label"=>"Currency"], |
|
162 | + ["data"=>$font->chart(), "label"=>"Chart"], |
|
163 | + ["data"=>$font->brands(), "label"=>"Brand"], |
|
164 | + ["data"=>$font->gender(), "label"=>"Gender"], |
|
165 | + ["data"=>$font->form(), "label"=>"Form"], |
|
166 | + ["data"=>$font->spinner(), "label"=>"Spinner"] |
|
167 | 167 | ]; |
168 | 168 | ?> |
169 | 169 | @foreach($fontData as $f) |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | public function handle() |
33 | 33 | { |
34 | 34 | |
35 | - if($this->option("generate")) { |
|
35 | + if ($this->option("generate")) { |
|
36 | 36 | $this->info("== Generating Seeder =="); |
37 | 37 | $this->generateSeeder(); |
38 | 38 | $this->info("== Finish =="); |
39 | - }else{ |
|
39 | + } else { |
|
40 | 40 | $this->info("== Importing the seeder =="); |
41 | - $this->call("db:seed",["--class"=>"CbMigrationSeeder"]); |
|
41 | + $this->call("db:seed", ["--class"=>"CbMigrationSeeder"]); |
|
42 | 42 | $this->info("== Finish =="); |
43 | 43 | } |
44 | 44 | |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | $php_string = ""; |
51 | 51 | $additional_tables = cbConfig("ADDITIONAL_DATA_MIGRATION"); |
52 | 52 | |
53 | - foreach($tables as $table) { |
|
54 | - if(substr($table,0,3) == "cb_" || in_array($table, $additional_tables)) { |
|
53 | + foreach ($tables as $table) { |
|
54 | + if (substr($table, 0, 3) == "cb_" || in_array($table, $additional_tables)) { |
|
55 | 55 | $this->info("Create seeder for table : ".$table); |
56 | 56 | $rows = DB::table($table)->get(); |
57 | 57 | $data = []; |
58 | - foreach($rows as $i=>$row) { |
|
58 | + foreach ($rows as $i=>$row) { |
|
59 | 59 | $data[$i] = []; |
60 | - foreach($row as $key=>$val) { |
|
60 | + foreach ($row as $key=>$val) { |
|
61 | 61 | $data[$i][$key] = $val; |
62 | 62 | } |
63 | 63 | } |
64 | - if(count($data)!=0) { |
|
64 | + if (count($data) != 0) { |
|
65 | 65 | $php_string .= 'DB::table(\''.$table.'\')->delete();'."\n\t\t\t"; |
66 | 66 | $php_string .= 'DB::table(\''.$table.'\')->insert('.min_var_export($data).');'."\n\t\t\t"; |
67 | 67 | } |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $composer_path = ''; |
92 | 92 | if (file_exists(getcwd().'/composer.phar')) { |
93 | 93 | $composer_path = '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
94 | - }else{ |
|
94 | + } else { |
|
95 | 95 | $composer_path = 'composer'; |
96 | 96 | } |
97 | 97 |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | $this->info("== Generating Seeder =="); |
37 | 37 | $this->generateSeeder(); |
38 | 38 | $this->info("== Finish =="); |
39 | - }else{ |
|
39 | + } else{ |
|
40 | 40 | $this->info("== Importing the seeder =="); |
41 | 41 | $this->call("db:seed",["--class"=>"CbMigrationSeeder"]); |
42 | 42 | $this->info("== Finish =="); |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | $composer_path = ''; |
92 | 92 | if (file_exists(getcwd().'/composer.phar')) { |
93 | 93 | $composer_path = '"'.PHP_BINARY.'" '.getcwd().'/composer.phar'; |
94 | - }else{ |
|
94 | + } else{ |
|
95 | 95 | $composer_path = 'composer'; |
96 | 96 | } |
97 | 97 |
@@ -29,11 +29,11 @@ discard block |
||
29 | 29 | $this->setButtonDetail(true); |
30 | 30 | $this->setButtonSave(true); |
31 | 31 | $this->setButtonLimitPage(true); |
32 | - $this->hideButtonDeleteWhen(function ($row) { return false; }); |
|
33 | - $this->hideButtonDetailWhen(function ($row) { return false; }); |
|
34 | - $this->hideButtonEditWhen(function ($row) { return false; }); |
|
35 | - $this->style(function () { return null; }); |
|
36 | - $this->javascript(function () { return null; }); |
|
32 | + $this->hideButtonDeleteWhen(function($row) { return false; }); |
|
33 | + $this->hideButtonDetailWhen(function($row) { return false; }); |
|
34 | + $this->hideButtonEditWhen(function($row) { return false; }); |
|
35 | + $this->style(function() { return null; }); |
|
36 | + $this->javascript(function() { return null; }); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | public function style(callable $style) { |
@@ -137,9 +137,9 @@ discard block |
||
137 | 137 | * @param ButtonColor $color |
138 | 138 | * @param string $attributes |
139 | 139 | */ |
140 | - public function addIndexActionButton($label, $actionURL, $fontAwesome_icon=null, $color=null, $attributes = null) |
|
140 | + public function addIndexActionButton($label, $actionURL, $fontAwesome_icon = null, $color = null, $attributes = null) |
|
141 | 141 | { |
142 | - $color = ($color)?:ButtonColor::DARK_BLUE; |
|
142 | + $color = ($color) ?: ButtonColor::DARK_BLUE; |
|
143 | 143 | |
144 | 144 | $model = new IndexActionButtonModel(); |
145 | 145 | $model->setLabel($label); |
@@ -194,12 +194,12 @@ discard block |
||
194 | 194 | * @param $fontAwesome_icon |
195 | 195 | * @param ButtonColor|string $color |
196 | 196 | */ |
197 | - public function addActionButton($label, $url_target, $condition_callback=null, $fontAwesome_icon=null, $color=null, $confirmation = false) |
|
197 | + public function addActionButton($label, $url_target, $condition_callback = null, $fontAwesome_icon = null, $color = null, $confirmation = false) |
|
198 | 198 | { |
199 | 199 | $new = new AddActionButtonModel(); |
200 | 200 | $new->setLabel($label); |
201 | - $new->setIcon($fontAwesome_icon?:"fa fa-bars"); |
|
202 | - $new->setColor($color?:"primary"); |
|
201 | + $new->setIcon($fontAwesome_icon ?: "fa fa-bars"); |
|
202 | + $new->setColor($color ?: "primary"); |
|
203 | 203 | $new->setUrl($url_target); |
204 | 204 | $new->setCondition($condition_callback); |
205 | 205 | $new->setConfirmation($confirmation); |