@@ -5,17 +5,17 @@ |
||
5 | 5 | /* |
6 | 6 | * Misc. |
7 | 7 | */ |
8 | -Blueprint::macro('ordering', function ($key = 'ordering', $length = 10) { |
|
8 | +Blueprint::macro('ordering', function($key = 'ordering', $length = 10) { |
|
9 | 9 | return $this->string($key, $length) |
10 | 10 | ->nullable() |
11 | 11 | ->comment('Ordering'); |
12 | 12 | }); |
13 | 13 | |
14 | -Blueprint::macro('percent', function ($key = 'percent') { |
|
14 | +Blueprint::macro('percent', function($key = 'percent') { |
|
15 | 15 | return $this->decimal($key, 5, 2)->default(0)->comment('Percentage'); |
16 | 16 | }); |
17 | 17 | |
18 | -Blueprint::macro('expired', function () { |
|
18 | +Blueprint::macro('expired', function() { |
|
19 | 19 | $this->boolean('is_expired')->default(false)->comment('Is Expired in Boolean'); |
20 | 20 | $this->datetime('expired_at')->nullable()->comment('Expired Date Time'); |
21 | 21 |
@@ -30,9 +30,9 @@ |
||
30 | 30 | return $schema; |
31 | 31 | }); |
32 | 32 | |
33 | - Blueprint::macro('addNullableForeign', function ($table, $fk, $bigInteger = false) { |
|
34 | - return $this->addForeign($table, ['nullable' => true, 'fk' => $fk, 'bigInteger' => $bigInteger])->comment('Nullable FK for ' . $table); |
|
35 | - }); |
|
33 | + Blueprint::macro('addNullableForeign', function ($table, $fk, $bigInteger = false) { |
|
34 | + return $this->addForeign($table, ['nullable' => true, 'fk' => $fk, 'bigInteger' => $bigInteger])->comment('Nullable FK for ' . $table); |
|
35 | + }); |
|
36 | 36 | |
37 | 37 | Blueprint::macro('referenceOn', function ($key, $table, $reference = 'id') { |
38 | 38 | return $this->foreign($key) |
@@ -6,7 +6,7 @@ discard block |
||
6 | 6 | /* |
7 | 7 | * Foreign Key |
8 | 8 | */ |
9 | -Blueprint::macro('addForeign', function ($table, $options = []) { |
|
9 | +Blueprint::macro('addForeign', function($table, $options = []) { |
|
10 | 10 | $fk = (isset($options['fk']) && ! empty($options['fk'])) ? |
11 | 11 | $options['fk'] : strtolower(Str::singular($table)) . '_id'; |
12 | 12 | |
@@ -23,24 +23,24 @@ discard block |
||
23 | 23 | $schema->nullable(); |
24 | 24 | } |
25 | 25 | |
26 | - if (! isset($options['no_reference'])) { |
|
26 | + if ( ! isset($options['no_reference'])) { |
|
27 | 27 | $this->referenceOn($fk, $table, $reference); |
28 | 28 | } |
29 | 29 | |
30 | 30 | return $schema; |
31 | 31 | }); |
32 | 32 | |
33 | - Blueprint::macro('addNullableForeign', function ($table, $fk, $bigInteger = false) { |
|
33 | + Blueprint::macro('addNullableForeign', function($table, $fk, $bigInteger = false) { |
|
34 | 34 | return $this->addForeign($table, ['nullable' => true, 'fk' => $fk, 'bigInteger' => $bigInteger])->comment('Nullable FK for ' . $table); |
35 | 35 | }); |
36 | 36 | |
37 | -Blueprint::macro('referenceOn', function ($key, $table, $reference = 'id') { |
|
37 | +Blueprint::macro('referenceOn', function($key, $table, $reference = 'id') { |
|
38 | 38 | return $this->foreign($key) |
39 | 39 | ->references($reference) |
40 | 40 | ->on($table); |
41 | 41 | }); |
42 | 42 | |
43 | -Blueprint::macro('belongsTo', function ($table, $key = null, $bigInteger = false, $reference = 'id') { |
|
43 | +Blueprint::macro('belongsTo', function($table, $key = null, $bigInteger = false, $reference = 'id') { |
|
44 | 44 | if (is_null($key)) { |
45 | 45 | $key = strtolower(Str::singular($table)) . '_id'; |
46 | 46 | } |
@@ -48,7 +48,7 @@ discard block |
||
48 | 48 | return $this->addForeign($table, ['fk' => $key, 'reference' => $reference, 'bigInteger' => $bigInteger])->comment('FK for ' . $table); |
49 | 49 | }); |
50 | 50 | |
51 | -Blueprint::macro('nullableBelongsTo', function ($table, $key = null, $bigInteger = false, $reference = 'id') { |
|
51 | +Blueprint::macro('nullableBelongsTo', function($table, $key = null, $bigInteger = false, $reference = 'id') { |
|
52 | 52 | if (is_null($key)) { |
53 | 53 | $key = strtolower(Str::singular($table)) . '_id'; |
54 | 54 | } |
@@ -5,21 +5,21 @@ |
||
5 | 5 | /* |
6 | 6 | * Money |
7 | 7 | */ |
8 | -Blueprint::macro('money', function ($label = 'money', $percision = 8, $scale = 2) { |
|
8 | +Blueprint::macro('money', function($label = 'money', $percision = 8, $scale = 2) { |
|
9 | 9 | return $this->decimal($label, $percision, $scale) |
10 | 10 | ->nullable() |
11 | 11 | ->default(0.00) |
12 | 12 | ->comment('Money'); |
13 | 13 | }); |
14 | 14 | |
15 | -Blueprint::macro('amount', function ($label = 'amount') { |
|
15 | +Blueprint::macro('amount', function($label = 'amount') { |
|
16 | 16 | return $this->bigInteger($label) |
17 | 17 | ->nullable() |
18 | 18 | ->default(0) |
19 | 19 | ->comment('Big amount of money'); |
20 | 20 | }); |
21 | 21 | |
22 | -Blueprint::macro('smallAmount', function ($label = 'amount') { |
|
22 | +Blueprint::macro('smallAmount', function($label = 'amount') { |
|
23 | 23 | return $this->integer($label) |
24 | 24 | ->nullable() |
25 | 25 | ->default(0) |
@@ -5,11 +5,11 @@ discard block |
||
5 | 5 | /* |
6 | 6 | * Identifier Replacement |
7 | 7 | */ |
8 | -Blueprint::macro('uuid', function ($length = 64) { |
|
8 | +Blueprint::macro('uuid', function($length = 64) { |
|
9 | 9 | return $this->string('uuid', $length)->comment('UUID'); |
10 | 10 | }); |
11 | 11 | |
12 | -Blueprint::macro('hashslug', function ($length = 64) { |
|
12 | +Blueprint::macro('hashslug', function($length = 64) { |
|
13 | 13 | return $this->string('hashslug') |
14 | 14 | ->length($length) |
15 | 15 | ->nullable() |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | ->comment('Hashed Slug'); |
19 | 19 | }); |
20 | 20 | |
21 | -Blueprint::macro('slug', function () { |
|
21 | +Blueprint::macro('slug', function() { |
|
22 | 22 | return $this->string('slug') |
23 | 23 | ->nullable() |
24 | 24 | ->unique() |