File tree Expand file tree Collapse file tree 2 files changed +59
-9
lines changed Expand file tree Collapse file tree 2 files changed +59
-9
lines changed Original file line number Diff line number Diff line change 44
55class MigrationField
66{
7- protected $ name ;
7+ private $ name ;
88
9- protected $ type ;
9+ private $ type ;
1010
11- protected $ nullable = false ;
11+ private $ nullable = false ;
1212
13- protected $ unique = false ;
13+ private $ unique = false ;
1414
15- protected $ default = null ;
15+ private $ default = null ;
1616
17- protected $ foreign = null ;
17+ private $ foreign = null ;
1818
1919 public function __construct (string $ field )
2020 {
@@ -53,4 +53,44 @@ private function fillObject(string $param)
5353 return $ this ->default = $ match [1 ];
5454 }
5555 }
56+
57+ /**
58+ * @return string
59+ */
60+ public function getName ()
61+ {
62+ return $ this ->name ;
63+ }
64+
65+ /**
66+ * @return string
67+ */
68+ public function getType ()
69+ {
70+ return $ this ->type ;
71+ }
72+
73+ /**
74+ * @return mixed
75+ */
76+ public function getDefault ()
77+ {
78+ return $ this ->default ;
79+ }
80+
81+ /**
82+ * @return bool
83+ */
84+ public function isNullable ()
85+ {
86+ return $ this ->nullable ;
87+ }
88+
89+ /**
90+ * @return bool
91+ */
92+ public function isUnique (): bool
93+ {
94+ return $ this ->unique ;
95+ }
5696}
Original file line number Diff line number Diff line change 22
33namespace Webfactor \Laravel \Generators ;
44
5+ use Illuminate \Support \Collection ;
6+
57class MigrationSchema
68{
7- protected $ schema ;
9+ protected $ structure ;
810
911 public function __construct (string $ schema )
1012 {
11- $ this ->schema = collect ();
13+ $ this ->structure = collect ();
1214
1315 foreach (explode (', ' , $ schema ) as $ field ) {
14- $ this ->schema ->push (new MigrationField ($ field ));
16+ $ this ->structure ->push (new MigrationField ($ field ));
1517 }
1618 }
19+
20+ /**
21+ * @return Collection
22+ */
23+ public function getStructure (): Collection
24+ {
25+ return $ this ->structure ;
26+ }
1727}
You can’t perform that action at this time.
0 commit comments