@@ -5,6 +5,6 @@ |
||
| 5 | 5 | class IntegerType extends GeneralType |
| 6 | 6 | {
|
| 7 | 7 | protected $dataType = 'integer'; |
| 8 | - protected $formType = 'integer'; |
|
| 9 | - protected $size = false; |
|
| 8 | + protected $formType = 'integer'; |
|
| 9 | + protected $size = false; |
|
| 10 | 10 | } |
@@ -4,9 +4,9 @@ |
||
| 4 | 4 | |
| 5 | 5 | class DateType extends GeneralType |
| 6 | 6 | {
|
| 7 | - protected $dataType = 'date'; |
|
| 8 | - protected $formType = 'date'; |
|
| 9 | - protected $size = false; |
|
| 10 | - protected $validationRule = 'date_format:Y-m-d'; |
|
| 7 | + protected $dataType = 'date'; |
|
| 8 | + protected $formType = 'date'; |
|
| 9 | + protected $size = false; |
|
| 10 | + protected $validationRule = 'date_format:Y-m-d'; |
|
| 11 | 11 | |
| 12 | 12 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | class MixedFileType extends SingleType |
| 6 | 6 | {
|
| 7 | - protected $hasFile = true; |
|
| 8 | - protected $extensions = '.zip,.doc,.txt,.pdf,.csv'; |
|
| 9 | - protected $formType = 'file'; |
|
| 7 | + protected $hasFile = true; |
|
| 8 | + protected $extensions = '.zip,.doc,.txt,.pdf,.csv'; |
|
| 9 | + protected $formType = 'file'; |
|
| 10 | 10 | } |
@@ -4,7 +4,7 @@ |
||
| 4 | 4 | |
| 5 | 5 | class ImageType extends SingleType |
| 6 | 6 | {
|
| 7 | - protected $hasImage = true; |
|
| 8 | - protected $formType = 'image'; |
|
| 9 | - protected $extensions = '.png,.jpg,.gif,.bmp,.jpeg'; |
|
| 7 | + protected $hasImage = true; |
|
| 8 | + protected $formType = 'image'; |
|
| 9 | + protected $extensions = '.png,.jpg,.gif,.bmp,.jpeg'; |
|
| 10 | 10 | } |
@@ -29,12 +29,12 @@ discard block |
||
| 29 | 29 | |
| 30 | 30 | public function getPivotTable() |
| 31 | 31 | {
|
| 32 | - return $this->getParentModelLowercase() . "_" . strtolower(Str::plural($this->columnName)); |
|
| 32 | + return $this->getParentModelLowercase()."_".strtolower(Str::plural($this->columnName)); |
|
| 33 | 33 | } |
| 34 | 34 | |
| 35 | 35 | public function getMigrationPivot() |
| 36 | 36 | {
|
| 37 | - return $this->getParentModel() . Str::plural($this->getChildModel()); |
|
| 37 | + return $this->getParentModel().Str::plural($this->getChildModel()); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | public function getRelatedModel() |
@@ -44,7 +44,7 @@ discard block |
||
| 44 | 44 | |
| 45 | 45 | public function getPivot() |
| 46 | 46 | {
|
| 47 | - return $this->getParentModel() . $this->getChildModel(); |
|
| 47 | + return $this->getParentModel().$this->getChildModel(); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function getPivotColumns() |
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | class AttachmentType extends MultipleType |
| 6 | 6 | {
|
| 7 | 7 | protected $hasFile = true; |
| 8 | - protected $formType = 'multipleFiles'; |
|
| 8 | + protected $formType = 'multipleFiles'; |
|
| 9 | 9 | |
| 10 | 10 | public function getLaragenColumns() |
| 11 | 11 | {
|
@@ -5,7 +5,7 @@ |
||
| 5 | 5 | class GalleryType extends MultipleType |
| 6 | 6 | {
|
| 7 | 7 | protected $hasImage = true; |
| 8 | - protected $formType = 'gallery'; |
|
| 8 | + protected $formType = 'gallery'; |
|
| 9 | 9 | |
| 10 | 10 | public function getLaragenColumns() |
| 11 | 11 | {
|
@@ -4,5 +4,5 @@ |
||
| 4 | 4 | |
| 5 | 5 | class SingleType extends FileType |
| 6 | 6 | {
|
| 7 | - protected $dataType = 'string'; |
|
| 7 | + protected $dataType = 'string'; |
|
| 8 | 8 | } |
@@ -9,14 +9,14 @@ discard block |
||
| 9 | 9 | protected $uniqueFlag; |
| 10 | 10 | protected $requiredFlag; |
| 11 | 11 | protected $isDisplay; |
| 12 | - protected $dataType; |
|
| 13 | - protected $formType; |
|
| 14 | - protected $stubs = []; |
|
| 15 | - protected $size = false; |
|
| 16 | - protected $validationRule = null; |
|
| 17 | - protected $moduleName; |
|
| 18 | - protected $columnName; |
|
| 19 | - protected $optionString; |
|
| 12 | + protected $dataType; |
|
| 13 | + protected $formType; |
|
| 14 | + protected $stubs = []; |
|
| 15 | + protected $size = false; |
|
| 16 | + protected $validationRule = null; |
|
| 17 | + protected $moduleName; |
|
| 18 | + protected $columnName; |
|
| 19 | + protected $optionString; |
|
| 20 | 20 | |
| 21 | 21 | public function __construct($moduleName, $columnName, $optionString) |
| 22 | 22 | {
|
@@ -52,11 +52,11 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | return property_exists($this, $method) ? $this->$method : ""; |
| 55 | - } |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | 57 | public function isRelational() |
| 58 | 58 | {
|
| 59 | - return $this->relationalType; |
|
| 59 | + return $this->relationalType; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | public function getSchema() |
@@ -68,7 +68,7 @@ discard block |
||
| 68 | 68 | $schema .= ";"; |
| 69 | 69 | |
| 70 | 70 | return $schema; |
| 71 | - } |
|
| 71 | + } |
|
| 72 | 72 | |
| 73 | 73 | public function getValidationLine() |
| 74 | 74 | {
|
@@ -29,13 +29,13 @@ discard block |
||
| 29 | 29 | $type = explode(':', $typePieces);
|
| 30 | 30 | $this->typeOption = is_array($type) && count($type) >= 2 ? $type[1] : false; |
| 31 | 31 | |
| 32 | - if(in_array(TypeResolver::COLUMN_UNIQUE, $this->optionArray)){
|
|
| 32 | + if (in_array(TypeResolver::COLUMN_UNIQUE, $this->optionArray)) {
|
|
| 33 | 33 | $this->setUnique(); |
| 34 | 34 | } |
| 35 | - if(in_array(TypeResolver::COLUMN_REQUIRED, $this->optionArray)){
|
|
| 35 | + if (in_array(TypeResolver::COLUMN_REQUIRED, $this->optionArray)) {
|
|
| 36 | 36 | $this->setRequired(); |
| 37 | 37 | } |
| 38 | - if(in_array("*", $this->optionArray)){
|
|
| 38 | + if (in_array("*", $this->optionArray)) {
|
|
| 39 | 39 | $this->setIsDisplay(); |
| 40 | 40 | } |
| 41 | 41 | } |
@@ -81,9 +81,9 @@ discard block |
||
| 81 | 81 | |
| 82 | 82 | if ($this->isUnique()) {
|
| 83 | 83 | $validationLine = '($this->'.$modelname.') ? \''; |
| 84 | - $validationLine .= $rules . '|unique:'.$this->moduleName.','.$this->getColumn().','.'\''.'.$this->'.$modelname.'->id : \''; |
|
| 85 | - $validationLine .= $rules . '|unique:'.$this->moduleName.'\''; |
|
| 86 | - } else{
|
|
| 84 | + $validationLine .= $rules.'|unique:'.$this->moduleName.','.$this->getColumn().','.'\''.'.$this->'.$modelname.'->id : \''; |
|
| 85 | + $validationLine .= $rules.'|unique:'.$this->moduleName.'\''; |
|
| 86 | + } else {
|
|
| 87 | 87 | $validationLine = "'{$rules}'";
|
| 88 | 88 | } |
| 89 | 89 | return $validationLine; |
@@ -98,16 +98,16 @@ discard block |
||
| 98 | 98 | |
| 99 | 99 | public function getForeignKey() |
| 100 | 100 | {
|
| 101 | - return $this->columnName . "_id"; |
|
| 101 | + return $this->columnName."_id"; |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | public function getFilteredColumns($options = [], $columnsOnly = false) |
| 105 | 105 | {
|
| 106 | 106 | $filteredTypes = []; |
| 107 | 107 | $options = is_array($options) ? $options : [$options]; |
| 108 | - foreach($this->getPivotColumns() as $type){
|
|
| 108 | + foreach ($this->getPivotColumns() as $type) {
|
|
| 109 | 109 | foreach ($options as $option) {
|
| 110 | - if($type->$option()){
|
|
| 110 | + if ($type->$option()) {
|
|
| 111 | 111 | $filteredTypes[] = $columnsOnly ? $type->getColumn() : $type; |
| 112 | 112 | break; |
| 113 | 113 | } |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | public function getChildModel() |
| 135 | 135 | {
|
| 136 | - return ucfirst(Str::camel(Str::singular($this->typeOption ?: $this->columnName ))); |
|
| 136 | + return ucfirst(Str::camel(Str::singular($this->typeOption ?: $this->columnName))); |
|
| 137 | 137 | } |
| 138 | 138 | |
| 139 | 139 | public function getParentModel() |
@@ -158,8 +158,9 @@ |
||
| 158 | 158 | |
| 159 | 159 | |
| 160 | 160 | public function getTextRows() {
|
| 161 | - if (!$this->size) |
|
| 162 | - return 4; |
|
| 161 | + if (!$this->size) { |
|
| 162 | + return 4; |
|
| 163 | + } |
|
| 163 | 164 | |
| 164 | 165 | return floor($this->getsize() / 120); |
| 165 | 166 | } |