@@ -1,57 +1,57 @@ |
||
| 1 | 1 | <?php |
| 2 | 2 | |
| 3 | 3 | return [ |
| 4 | - 'options' => [ |
|
| 5 | - 'generated_by_default' => ['migration', 'controller', 'model'], |
|
| 6 | - 'override' => true |
|
| 7 | - ], |
|
| 8 | - 'modules' => [ |
|
| 4 | + 'options' => [ |
|
| 5 | + 'generated_by_default' => ['migration', 'controller', 'model'], |
|
| 6 | + 'override' => true |
|
| 7 | + ], |
|
| 8 | + 'modules' => [ |
|
| 9 | 9 | |
| 10 | - // optional parameters : |
|
| 11 | - // 'multiple'=>[] |
|
| 12 | - // 'images'=>'single' //Images type: single, multiple |
|
| 10 | + // optional parameters : |
|
| 11 | + // 'multiple'=>[] |
|
| 12 | + // 'images'=>'single' //Images type: single, multiple |
|
| 13 | 13 | |
| 14 | - 'categories' => [ |
|
| 15 | - 'data'=> [ |
|
| 16 | - // Separated by ':', numeric value represents size of the field its 192 by default and is optional |
|
| 14 | + 'categories' => [ |
|
| 15 | + 'data'=> [ |
|
| 16 | + // Separated by ':', numeric value represents size of the field its 192 by default and is optional |
|
| 17 | 17 | |
| 18 | - // Regular data types: |
|
| 19 | - // string, int, text, bool, date |
|
| 18 | + // Regular data types: |
|
| 19 | + // string, int, text, bool, date |
|
| 20 | 20 | |
| 21 | - // Data type modifiers |
|
| 22 | - // unique |
|
| 21 | + // Data type modifiers |
|
| 22 | + // unique |
|
| 23 | 23 | |
| 24 | - //Must start with data type nd then followed by size, then by modifiers if required |
|
| 24 | + //Must start with data type nd then followed by size, then by modifiers if required |
|
| 25 | 25 | |
| 26 | - // Special data types: |
|
| 27 | - // parent: requires name of a module, creates a one-to-many relation with the current module |
|
| 28 | - // related: requires name of a module, creates many to many relation with current module |
|
| 26 | + // Special data types: |
|
| 27 | + // parent: requires name of a module, creates a one-to-many relation with the current module |
|
| 28 | + // related: requires name of a module, creates many to many relation with current module |
|
| 29 | 29 | |
| 30 | - 'title' => 'string:128', |
|
| 31 | - 'slug' => 'string:128:unique', |
|
| 32 | - 'short_description' => 'string', |
|
| 33 | - ], |
|
| 34 | - 'images'=>'single' |
|
| 35 | - ], |
|
| 30 | + 'title' => 'string:128', |
|
| 31 | + 'slug' => 'string:128:unique', |
|
| 32 | + 'short_description' => 'string', |
|
| 33 | + ], |
|
| 34 | + 'images'=>'single' |
|
| 35 | + ], |
|
| 36 | 36 | |
| 37 | - 'tags' => [ |
|
| 38 | - 'data'=> [ |
|
| 39 | - 'title' => 'string:128' |
|
| 40 | - ] |
|
| 41 | - ], |
|
| 37 | + 'tags' => [ |
|
| 38 | + 'data'=> [ |
|
| 39 | + 'title' => 'string:128' |
|
| 40 | + ] |
|
| 41 | + ], |
|
| 42 | 42 | |
| 43 | - 'posts' => [ |
|
| 44 | - 'data' => [ |
|
| 45 | - 'author' => 'parent:users', |
|
| 46 | - 'title' => 'string:256', |
|
| 47 | - 'slug' => 'string:128:unique', |
|
| 48 | - 'short_description' => 'string', |
|
| 49 | - 'full_description' => 'text', |
|
| 50 | - 'category' => 'parent:categories', |
|
| 51 | - 'posted_at' => 'datetime', |
|
| 52 | - 'tags' => 'related:tags' |
|
| 53 | - ], |
|
| 54 | - 'images'=>'multiple' |
|
| 55 | - ], |
|
| 56 | - ] |
|
| 43 | + 'posts' => [ |
|
| 44 | + 'data' => [ |
|
| 45 | + 'author' => 'parent:users', |
|
| 46 | + 'title' => 'string:256', |
|
| 47 | + 'slug' => 'string:128:unique', |
|
| 48 | + 'short_description' => 'string', |
|
| 49 | + 'full_description' => 'text', |
|
| 50 | + 'category' => 'parent:categories', |
|
| 51 | + 'posted_at' => 'datetime', |
|
| 52 | + 'tags' => 'related:tags' |
|
| 53 | + ], |
|
| 54 | + 'images'=>'multiple' |
|
| 55 | + ], |
|
| 56 | + ] |
|
| 57 | 57 | ]; |
@@ -6,7 +6,7 @@ |
||
| 6 | 6 | |
| 7 | 7 | class BaseGenerator |
| 8 | 8 | { |
| 9 | - protected $module; |
|
| 9 | + protected $module; |
|
| 10 | 10 | |
| 11 | 11 | public function getModule() |
| 12 | 12 | { |
@@ -50,10 +50,14 @@ |
||
| 50 | 50 | { |
| 51 | 51 | if ($this->hasSpecialSchema()) { |
| 52 | 52 | $schema = $this->processSpecialSchema(); |
| 53 | - }else{ |
|
| 53 | + } else{ |
|
| 54 | 54 | foreach ($this->optionArray as $option) { |
| 55 | - if ($option == self::COLUMN_UNIQUE) $this->hasUnique(); |
|
| 56 | - if (is_numeric($option) && $option <= 2048) $this->hasSize((int)$option); |
|
| 55 | + if ($option == self::COLUMN_UNIQUE) { |
|
| 56 | + $this->hasUnique(); |
|
| 57 | + } |
|
| 58 | + if (is_numeric($option) && $option <= 2048) { |
|
| 59 | + $this->hasSize((int)$option); |
|
| 60 | + } |
|
| 57 | 61 | } |
| 58 | 62 | |
| 59 | 63 | $schema = '$table->' . $this->getType() . "('{$this->column}'"; |