@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | /* |
22 | 22 | * Foreign Key |
23 | 23 | */ |
24 | - DefaultBlueprint::macro('addForeign', function ($table, $options = []) { |
|
24 | + DefaultBlueprint::macro('addForeign', function($table, $options = []) { |
|
25 | 25 | $fk = (isset($options['fk']) && ! empty($options['fk'])) ? |
26 | 26 | $options['fk'] : Str::lower(Str::singular($table)) . '_id'; |
27 | 27 | |
@@ -38,24 +38,24 @@ discard block |
||
38 | 38 | $schema->nullable(); |
39 | 39 | } |
40 | 40 | |
41 | - if (! isset($options['no_reference'])) { |
|
41 | + if ( ! isset($options['no_reference'])) { |
|
42 | 42 | $this->referenceOn($fk, $table, $reference); |
43 | 43 | } |
44 | 44 | |
45 | 45 | return $schema; |
46 | 46 | }); |
47 | 47 | |
48 | - DefaultBlueprint::macro('addNullableForeign', function ($table, $fk, $bigInteger = false) { |
|
48 | + DefaultBlueprint::macro('addNullableForeign', function($table, $fk, $bigInteger = false) { |
|
49 | 49 | return $this->addForeign($table, ['nullable' => true, 'fk' => $fk, 'bigInteger' => $bigInteger])->comment('Nullable FK for ' . $table); |
50 | 50 | }); |
51 | 51 | |
52 | - DefaultBlueprint::macro('referenceOn', function ($key, $table, $reference = 'id') { |
|
52 | + DefaultBlueprint::macro('referenceOn', function($key, $table, $reference = 'id') { |
|
53 | 53 | return $this->foreign($key) |
54 | 54 | ->references($reference) |
55 | 55 | ->on($table); |
56 | 56 | }); |
57 | 57 | |
58 | - DefaultBlueprint::macro('belongsTo', function ($table, $key = null, $bigInteger = false, $reference = 'id') { |
|
58 | + DefaultBlueprint::macro('belongsTo', function($table, $key = null, $bigInteger = false, $reference = 'id') { |
|
59 | 59 | if (is_null($key)) { |
60 | 60 | $key = Str::lower(Str::singular($table)) . '_id'; |
61 | 61 | } |
@@ -63,7 +63,7 @@ discard block |
||
63 | 63 | return $this->addForeign($table, ['fk' => $key, 'reference' => $reference, 'bigInteger' => $bigInteger])->comment('FK for ' . $table); |
64 | 64 | }); |
65 | 65 | |
66 | - DefaultBlueprint::macro('nullableBelongsTo', function ($table, $key = null, $bigInteger = false, $reference = 'id') { |
|
66 | + DefaultBlueprint::macro('nullableBelongsTo', function($table, $key = null, $bigInteger = false, $reference = 'id') { |
|
67 | 67 | if (is_null($key)) { |
68 | 68 | $key = Str::lower(Str::singular($table)) . '_id'; |
69 | 69 | } |
@@ -74,11 +74,11 @@ discard block |
||
74 | 74 | /* |
75 | 75 | * Common Setup |
76 | 76 | */ |
77 | - DefaultBlueprint::macro('user', function ($nullable = false) { |
|
77 | + DefaultBlueprint::macro('user', function($nullable = false) { |
|
78 | 78 | return $this->addForeign('users', ['nullable' => $nullable])->comment('Owner of the record.'); |
79 | 79 | }); |
80 | 80 | |
81 | - DefaultBlueprint::macro('standardTime', function () { |
|
81 | + DefaultBlueprint::macro('standardTime', function() { |
|
82 | 82 | $this->softDeletes(); |
83 | 83 | $this->timestamps(); |
84 | 84 | }); |
@@ -86,11 +86,11 @@ discard block |
||
86 | 86 | /* |
87 | 87 | * Identifier Replacement |
88 | 88 | */ |
89 | - DefaultBlueprint::macro('uuid', function ($length = 64) { |
|
89 | + DefaultBlueprint::macro('uuid', function($length = 64) { |
|
90 | 90 | return $this->string('uuid', $length)->comment('UUID'); |
91 | 91 | }); |
92 | 92 | |
93 | - DefaultBlueprint::macro('hashslug', function ($length = 64) { |
|
93 | + DefaultBlueprint::macro('hashslug', function($length = 64) { |
|
94 | 94 | return $this->string('hashslug') |
95 | 95 | ->length($length) |
96 | 96 | ->nullable() |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | ->comment('Hashed Slug'); |
100 | 100 | }); |
101 | 101 | |
102 | - DefaultBlueprint::macro('slug', function () { |
|
102 | + DefaultBlueprint::macro('slug', function() { |
|
103 | 103 | return $this->string('slug') |
104 | 104 | ->nullable() |
105 | 105 | ->unique() |
@@ -110,22 +110,22 @@ discard block |
||
110 | 110 | /* |
111 | 111 | * Short String |
112 | 112 | */ |
113 | - DefaultBlueprint::macro('label', function ($value = 'label', $length = 255) { |
|
113 | + DefaultBlueprint::macro('label', function($value = 'label', $length = 255) { |
|
114 | 114 | return $this->string($value, $length)->nullable()->comment($value); |
115 | 115 | }); |
116 | 116 | |
117 | - DefaultBlueprint::macro('name', function ($value = 'name', $length = 255) { |
|
117 | + DefaultBlueprint::macro('name', function($value = 'name', $length = 255) { |
|
118 | 118 | return $this->string($value, $length)->nullable()->comment($value); |
119 | 119 | }); |
120 | 120 | |
121 | - DefaultBlueprint::macro('code', function ($key = 'code', $length = 20) { |
|
121 | + DefaultBlueprint::macro('code', function($key = 'code', $length = 20) { |
|
122 | 122 | return $this->string($key, $length) |
123 | 123 | ->nullable() |
124 | 124 | ->index() |
125 | 125 | ->comment('Code'); |
126 | 126 | }); |
127 | 127 | |
128 | - DefaultBlueprint::macro('reference', function ($label = 'reference', $length = 64) { |
|
128 | + DefaultBlueprint::macro('reference', function($label = 'reference', $length = 64) { |
|
129 | 129 | return $this->string('reference', $length) |
130 | 130 | ->nullable() |
131 | 131 | ->unique() |
@@ -136,18 +136,18 @@ discard block |
||
136 | 136 | /* |
137 | 137 | * Long String |
138 | 138 | */ |
139 | - DefaultBlueprint::macro('remarks', function ($value = 'remarks') { |
|
139 | + DefaultBlueprint::macro('remarks', function($value = 'remarks') { |
|
140 | 140 | return $this->text($value)->nullable()->comment('Remarks'); |
141 | 141 | }); |
142 | 142 | |
143 | - DefaultBlueprint::macro('description', function ($label = 'description') { |
|
143 | + DefaultBlueprint::macro('description', function($label = 'description') { |
|
144 | 144 | return $this->text($label)->nullable()->comment('Description'); |
145 | 145 | }); |
146 | 146 | |
147 | 147 | /* |
148 | 148 | * Acceptance |
149 | 149 | */ |
150 | - DefaultBlueprint::macro('addAcceptance', function ($value, $table_by = 'users') { |
|
150 | + DefaultBlueprint::macro('addAcceptance', function($value, $table_by = 'users') { |
|
151 | 151 | $this->is($value); |
152 | 152 | $this->at($value); |
153 | 153 | $this->by($table_by, $value); |
@@ -156,52 +156,52 @@ discard block |
||
156 | 156 | return $this; |
157 | 157 | }); |
158 | 158 | |
159 | - DefaultBlueprint::macro('status', function ($key = 'status', $default = true) { |
|
159 | + DefaultBlueprint::macro('status', function($key = 'status', $default = true) { |
|
160 | 160 | return $this->boolean($key)->default($default)->comment('Status'); |
161 | 161 | }); |
162 | 162 | |
163 | - DefaultBlueprint::macro('is', function ($key = 'activated', $default = true, $prefix = 'is_') { |
|
163 | + DefaultBlueprint::macro('is', function($key = 'activated', $default = true, $prefix = 'is_') { |
|
164 | 164 | return $this->status($prefix . $key, $default)->comment('Is it ' . $key . '?'); |
165 | 165 | }); |
166 | 166 | |
167 | - DefaultBlueprint::macro('at', function ($key = 'activated', $suffix = '_at') { |
|
167 | + DefaultBlueprint::macro('at', function($key = 'activated', $suffix = '_at') { |
|
168 | 168 | return $this->datetime($key . $suffix)->nullable()->comment('Event occured at Date & Time'); |
169 | 169 | }); |
170 | 170 | |
171 | - DefaultBlueprint::macro('by', function ($table, $key = null, $nullable = true, $bigInteger = false, $suffix = '_by') { |
|
171 | + DefaultBlueprint::macro('by', function($table, $key = null, $nullable = true, $bigInteger = false, $suffix = '_by') { |
|
172 | 172 | return $this->addForeign($table, [ |
173 | - 'fk' => (! is_null($key) ? $key . $suffix : null), |
|
173 | + 'fk' => ( ! is_null($key) ? $key . $suffix : null), |
|
174 | 174 | 'nullable' => $nullable, |
175 | 175 | 'bigInteger' => $bigInteger, |
176 | 176 | ]); |
177 | 177 | }); |
178 | 178 | |
179 | 179 | // will be deprecated |
180 | - DefaultBlueprint::macro('actedStatus', function ($value = 'is_acted') { |
|
180 | + DefaultBlueprint::macro('actedStatus', function($value = 'is_acted') { |
|
181 | 181 | return $this->boolean($value)->default(false)->comment('Action statys in Boolean'); |
182 | 182 | }); |
183 | 183 | |
184 | 184 | // will be deprecated |
185 | - DefaultBlueprint::macro('actedAt', function ($value = 'acted_at') { |
|
185 | + DefaultBlueprint::macro('actedAt', function($value = 'acted_at') { |
|
186 | 186 | return $this->datetime($value)->nullable()->comment('Acted at Date & Time'); |
187 | 187 | }); |
188 | 188 | |
189 | 189 | // will be deprecated |
190 | - DefaultBlueprint::macro('actedBy', function ($value = 'acted_by') { |
|
190 | + DefaultBlueprint::macro('actedBy', function($value = 'acted_by') { |
|
191 | 191 | return $this->unsignedInteger($value)->nullable()->comment('Done / Acted by an actor'); |
192 | 192 | }); |
193 | 193 | |
194 | 194 | /* |
195 | 195 | * Money |
196 | 196 | */ |
197 | - DefaultBlueprint::macro('amount', function ($label = 'amount') { |
|
197 | + DefaultBlueprint::macro('amount', function($label = 'amount') { |
|
198 | 198 | return $this->bigInteger($label) |
199 | 199 | ->nullable() |
200 | 200 | ->default(0) |
201 | 201 | ->comment('Big amount of money'); |
202 | 202 | }); |
203 | 203 | |
204 | - DefaultBlueprint::macro('smallAmount', function ($label = 'amount') { |
|
204 | + DefaultBlueprint::macro('smallAmount', function($label = 'amount') { |
|
205 | 205 | return $this->integer($label) |
206 | 206 | ->nullable() |
207 | 207 | ->default(0) |
@@ -211,17 +211,17 @@ discard block |
||
211 | 211 | /* |
212 | 212 | * Misc. |
213 | 213 | */ |
214 | - DefaultBlueprint::macro('ordering', function ($key = 'ordering', $length = 10) { |
|
214 | + DefaultBlueprint::macro('ordering', function($key = 'ordering', $length = 10) { |
|
215 | 215 | return $this->string($key, $length) |
216 | 216 | ->nullable() |
217 | 217 | ->comment('Ordering'); |
218 | 218 | }); |
219 | 219 | |
220 | - DefaultBlueprint::macro('percent', function ($key = 'percent') { |
|
220 | + DefaultBlueprint::macro('percent', function($key = 'percent') { |
|
221 | 221 | return $this->decimal($key, 5, 2)->default(0)->comment('Percentage'); |
222 | 222 | }); |
223 | 223 | |
224 | - DefaultBlueprint::macro('expired', function () { |
|
224 | + DefaultBlueprint::macro('expired', function() { |
|
225 | 225 | $this->boolean('is_expired')->default(false)->comment('Is Expired in Boolean'); |
226 | 226 | $this->datetime('expired_at')->nullable()->comment('Expired Date Time'); |
227 | 227 |