@@ -79,10 +79,10 @@ discard block |
||
| 79 | 79 | $this->column = $columnName; |
| 80 | 80 | $this->size = false; |
| 81 | 81 | // dump($optionString); |
| 82 | - if(is_array($optionString) ){ |
|
| 82 | + if (is_array($optionString)) { |
|
| 83 | 83 | $this->dataType = 'multiple'; |
| 84 | 84 | $this->multipleOptions = []; |
| 85 | - foreach($optionString as $col => $multString){ |
|
| 85 | + foreach ($optionString as $col => $multString) { |
|
| 86 | 86 | $this->multipleOptions[] = new Self($col, $multString); |
| 87 | 87 | } |
| 88 | 88 | // dd($this->multipleOptions[0]); |
@@ -90,12 +90,12 @@ discard block |
||
| 90 | 90 | // dd($column); |
| 91 | 91 | // $option = ; |
| 92 | 92 | |
| 93 | - }else{ |
|
| 93 | + } else { |
|
| 94 | 94 | $this->optionArray = explode('|', $optionString); |
| 95 | 95 | $typePieces = array_shift($this->optionArray); |
| 96 | 96 | $type = explode(':', $typePieces); |
| 97 | 97 | $this->dataType = is_array($type) ? $type[0] : $type; |
| 98 | - $this->typeOption = is_array($type)&&count($type)>=2 ? $type[1] : false; |
|
| 98 | + $this->typeOption = is_array($type) && count($type) >= 2 ? $type[1] : false; |
|
| 99 | 99 | |
| 100 | 100 | foreach ($this->optionArray as $option) { |
| 101 | 101 | if ($option == self::COLUMN_UNIQUE) { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | $this->setRequired(); |
| 107 | 107 | continue; |
| 108 | 108 | } |
| 109 | - if(Str::contains($option, ':')){ |
|
| 109 | + if (Str::contains($option, ':')) { |
|
| 110 | 110 | $optionPieces = explode(':', $option); |
| 111 | 111 | $this->setOptions($optionPieces[0], $optionPieces[1]); |
| 112 | 112 | } |
@@ -118,9 +118,9 @@ discard block |
||
| 118 | 118 | |
| 119 | 119 | public function getSchema() |
| 120 | 120 | { |
| 121 | - if ($this->dataType=='parent') { |
|
| 121 | + if ($this->dataType == 'parent') { |
|
| 122 | 122 | $schema = $this->processParent(); |
| 123 | - } else if( in_array($this->dataType, ['gallery', 'related', 'multiple']) ){ |
|
| 123 | + } else if (in_array($this->dataType, ['gallery', 'related', 'multiple'])) { |
|
| 124 | 124 | $schema = ''; |
| 125 | 125 | } else { |
| 126 | 126 | $schema = '$table->'.$this->getColumnType()."('{$this->column}'"; |
@@ -142,8 +142,8 @@ discard block |
||
| 142 | 142 | |
| 143 | 143 | public function getType() { |
| 144 | 144 | $type = $this->dataType; |
| 145 | - if($type=='string'){ |
|
| 146 | - $type = (!$this->getSize() || $this->getSize()<=128) ? $type : 'text'; |
|
| 145 | + if ($type == 'string') { |
|
| 146 | + $type = (!$this->getSize() || $this->getSize() <= 128) ? $type : 'text'; |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | return $type; |
@@ -167,17 +167,17 @@ discard block |
||
| 167 | 167 | |
| 168 | 168 | public function getFormOptions() { |
| 169 | 169 | $options = ""; |
| 170 | - $options .= $this->isRequired() ? 'required="required" ' :''; |
|
| 171 | - $options .= $this->getType()=='text' ? 'rows="'.$this->getTextRows().'" ' :''; |
|
| 170 | + $options .= $this->isRequired() ? 'required="required" ' : ''; |
|
| 171 | + $options .= $this->getType() == 'text' ? 'rows="'.$this->getTextRows().'" ' : ''; |
|
| 172 | 172 | return $options; |
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | public function getTextRows() { |
| 177 | - if(!$this->size) |
|
| 177 | + if (!$this->size) |
|
| 178 | 178 | return 4; |
| 179 | 179 | |
| 180 | - return floor($this->getsize()/120); |
|
| 180 | + return floor($this->getsize() / 120); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | public function getTabs($number) |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | $this->size = $size; |
| 222 | 222 | } |
| 223 | 223 | |
| 224 | - public function optionArray(){ |
|
| 224 | + public function optionArray() { |
|
| 225 | 225 | return $this->optionArray; |
| 226 | 226 | } |
| 227 | 227 | |
@@ -90,7 +90,7 @@ discard block |
||
| 90 | 90 | // dd($column); |
| 91 | 91 | // $option = ; |
| 92 | 92 | |
| 93 | - }else{ |
|
| 93 | + } else{ |
|
| 94 | 94 | $this->optionArray = explode('|', $optionString); |
| 95 | 95 | $typePieces = array_shift($this->optionArray); |
| 96 | 96 | $type = explode(':', $typePieces); |
@@ -174,8 +174,9 @@ discard block |
||
| 174 | 174 | |
| 175 | 175 | |
| 176 | 176 | public function getTextRows() { |
| 177 | - if(!$this->size) |
|
| 178 | - return 4; |
|
| 177 | + if(!$this->size) { |
|
| 178 | + return 4; |
|
| 179 | + } |
|
| 179 | 180 | |
| 180 | 181 | return floor($this->getsize()/120); |
| 181 | 182 | } |