| @@ 5-40 (lines=36) @@ | ||
| 2 | ||
| 3 | namespace Webfactor\Laravel\Generators\Schemas; |
|
| 4 | ||
| 5 | class CrudColumn |
|
| 6 | { |
|
| 7 | private $type; |
|
| 8 | ||
| 9 | private $field; |
|
| 10 | ||
| 11 | public function __construct(MigrationField $migrationField) |
|
| 12 | { |
|
| 13 | $this->type = $migrationField->getType(); |
|
| 14 | $this->field = $migrationField->getName(); |
|
| 15 | } |
|
| 16 | ||
| 17 | public function generateColumn(): array |
|
| 18 | { |
|
| 19 | return [ |
|
| 20 | 'name' => $this->getField(), |
|
| 21 | 'type' => $this->getType(), |
|
| 22 | ]; |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @return string |
|
| 27 | */ |
|
| 28 | public function getField() |
|
| 29 | { |
|
| 30 | return $this->field; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return string |
|
| 35 | */ |
|
| 36 | public function getType() |
|
| 37 | { |
|
| 38 | return $this->type; |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||
| @@ 5-40 (lines=36) @@ | ||
| 2 | ||
| 3 | namespace Webfactor\Laravel\Generators\Schemas; |
|
| 4 | ||
| 5 | class CrudField |
|
| 6 | { |
|
| 7 | private $type; |
|
| 8 | ||
| 9 | private $field; |
|
| 10 | ||
| 11 | public function __construct(MigrationField $migrationField) |
|
| 12 | { |
|
| 13 | $this->type = $migrationField->getType(); |
|
| 14 | $this->field = $migrationField->getName(); |
|
| 15 | } |
|
| 16 | ||
| 17 | public function generateField(): array |
|
| 18 | { |
|
| 19 | return [ |
|
| 20 | 'name' => $this->getField(), |
|
| 21 | 'type' => $this->getType(), |
|
| 22 | ]; |
|
| 23 | } |
|
| 24 | ||
| 25 | /** |
|
| 26 | * @return string |
|
| 27 | */ |
|
| 28 | public function getField() |
|
| 29 | { |
|
| 30 | return $this->field; |
|
| 31 | } |
|
| 32 | ||
| 33 | /** |
|
| 34 | * @return string |
|
| 35 | */ |
|
| 36 | public function getType() |
|
| 37 | { |
|
| 38 | return $this->type; |
|
| 39 | } |
|
| 40 | } |
|
| 41 | ||