@@ -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 | } |
@@ -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 | } |
@@ -4,22 +4,22 @@ discard block |
||
4 | 4 | use Illuminate\Support\Str; |
5 | 5 | use Prateekkarki\Laragen\Models\TypeResolver; |
6 | 6 | |
7 | - /** |
|
8 | - * @method integer getSize() |
|
9 | - */ |
|
7 | + /** |
|
8 | + * @method integer getSize() |
|
9 | + */ |
|
10 | 10 | abstract class LaragenType |
11 | 11 | { |
12 | 12 | protected $uniqueFlag; |
13 | 13 | protected $requiredFlag; |
14 | 14 | protected $isDisplay; |
15 | - protected $dataType; |
|
16 | - protected $formType; |
|
17 | - protected $stubs = []; |
|
18 | - protected $size = false; |
|
19 | - protected $validationRule = null; |
|
20 | - protected $moduleName; |
|
21 | - protected $columnName; |
|
22 | - protected $optionString; |
|
15 | + protected $dataType; |
|
16 | + protected $formType; |
|
17 | + protected $stubs = []; |
|
18 | + protected $size = false; |
|
19 | + protected $validationRule = null; |
|
20 | + protected $moduleName; |
|
21 | + protected $columnName; |
|
22 | + protected $optionString; |
|
23 | 23 | |
24 | 24 | public function __construct($moduleName, $columnName, $optionString) |
25 | 25 | { |
@@ -55,11 +55,11 @@ discard block |
||
55 | 55 | } |
56 | 56 | |
57 | 57 | return property_exists($this, $method) ? $this->$method : ""; |
58 | - } |
|
58 | + } |
|
59 | 59 | |
60 | 60 | public function isRelational() |
61 | 61 | { |
62 | - return $this->relationalType; |
|
62 | + return $this->relationalType; |
|
63 | 63 | } |
64 | 64 | |
65 | 65 | public function getSchema() |
@@ -71,7 +71,7 @@ discard block |
||
71 | 71 | $schema .= ";"; |
72 | 72 | |
73 | 73 | return $schema; |
74 | - } |
|
74 | + } |
|
75 | 75 | |
76 | 76 | public function getValidationLine() |
77 | 77 | { |
@@ -32,13 +32,13 @@ discard block |
||
32 | 32 | $type = explode(':', $typePieces); |
33 | 33 | $this->typeOption = is_array($type) && count($type) >= 2 ? $type[1] : false; |
34 | 34 | |
35 | - if(in_array(TypeResolver::COLUMN_UNIQUE, $this->optionArray)){ |
|
35 | + if (in_array(TypeResolver::COLUMN_UNIQUE, $this->optionArray)) { |
|
36 | 36 | $this->setUnique(); |
37 | 37 | } |
38 | - if(in_array(TypeResolver::COLUMN_REQUIRED, $this->optionArray)){ |
|
38 | + if (in_array(TypeResolver::COLUMN_REQUIRED, $this->optionArray)) { |
|
39 | 39 | $this->setRequired(); |
40 | 40 | } |
41 | - if(in_array("*", $this->optionArray)){ |
|
41 | + if (in_array("*", $this->optionArray)) { |
|
42 | 42 | $this->setIsDisplay(); |
43 | 43 | } |
44 | 44 | } |
@@ -84,9 +84,9 @@ discard block |
||
84 | 84 | |
85 | 85 | if ($this->isUnique()) { |
86 | 86 | $validationLine = '($this->'.$modelname.') ? \''; |
87 | - $validationLine .= $rules . '|unique:'.$this->moduleName.','.$this->getColumn().','.'\''.'.$this->'.$modelname.'->id : \''; |
|
88 | - $validationLine .= $rules . '|unique:'.$this->moduleName.'\''; |
|
89 | - } else{ |
|
87 | + $validationLine .= $rules.'|unique:'.$this->moduleName.','.$this->getColumn().','.'\''.'.$this->'.$modelname.'->id : \''; |
|
88 | + $validationLine .= $rules.'|unique:'.$this->moduleName.'\''; |
|
89 | + } else { |
|
90 | 90 | $validationLine = "'{$rules}'"; |
91 | 91 | } |
92 | 92 | return $validationLine; |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | |
102 | 102 | public function getForeignKey() |
103 | 103 | { |
104 | - return $this->columnName . "_id"; |
|
104 | + return $this->columnName."_id"; |
|
105 | 105 | } |
106 | 106 | |
107 | 107 | public function getRelatedModel() |
@@ -121,7 +121,7 @@ discard block |
||
121 | 121 | |
122 | 122 | public function getChildModel() |
123 | 123 | { |
124 | - return ucfirst(Str::camel(Str::singular($this->typeOption ?? $this->columnName ))); |
|
124 | + return ucfirst(Str::camel(Str::singular($this->typeOption ?? $this->columnName))); |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | public function getParentModel() |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public function getDbData() |
21 | 21 | { |
22 | - return explode(':',$this->optionArray[0]); |
|
22 | + return explode(':', $this->optionArray[0]); |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | public function getPivotSchema() |
@@ -36,17 +36,17 @@ discard block |
||
36 | 36 | |
37 | 37 | public function getPivotTable() |
38 | 38 | { |
39 | - return $this->getParentModelLowercase() . "_" . Str::plural($this->columnName); |
|
39 | + return $this->getParentModelLowercase()."_".Str::plural($this->columnName); |
|
40 | 40 | } |
41 | 41 | |
42 | 42 | public function getMigrationPivot() |
43 | 43 | { |
44 | - return $this->getParentModel() . Str::plural($this->getChildModel()); |
|
44 | + return $this->getParentModel().Str::plural($this->getChildModel()); |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | public function getPivot() |
48 | 48 | { |
49 | - return $this->getParentModel() . $this->getChildModel(); |
|
49 | + return $this->getParentModel().$this->getChildModel(); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | public function getTypeColumns() |