@@ -7,33 +7,33 @@ |
||
7 | 7 | trait MorphsTo |
8 | 8 | { |
9 | 9 | /** |
10 | - * Defines a Belongs To Column and Relationship. |
|
11 | - * |
|
10 | + * Defines a Belongs To Column and Relationship. |
|
11 | + * |
|
12 | 12 | * @param string $morphable |
13 | 13 | * @param string|null $index |
14 | 14 | * |
15 | 15 | * @return \Reed\Blueprints\Columns |
16 | - */ |
|
16 | + */ |
|
17 | 17 | public function morphsTo($morphable, $index = null) |
18 | 18 | { |
19 | 19 | // Define the ID |
20 | 20 | $id = $this->morphsToIdColumn($morphable); |
21 | 21 | |
22 | - // Define the Type |
|
23 | - $type = $this->morphsToTypeColumn($morphable); |
|
22 | + // Define the Type |
|
23 | + $type = $this->morphsToTypeColumn($morphable); |
|
24 | 24 | |
25 | 25 | // Return the Columns |
26 | 26 | return $this->newColumns([$id, $type]); |
27 | 27 | } |
28 | 28 | |
29 | 29 | /** |
30 | - * Defines a Belongs To Column and Relationship using a Big Integer. |
|
31 | - * |
|
30 | + * Defines a Belongs To Column and Relationship using a Big Integer. |
|
31 | + * |
|
32 | 32 | * @param string $morphable |
33 | 33 | * @param string|null $index |
34 | 34 | * |
35 | 35 | * @return \Reed\Blueprints\Columns |
36 | - */ |
|
36 | + */ |
|
37 | 37 | public function bigMorphsTo($morphable, $index = null) |
38 | 38 | { |
39 | 39 | // Define the ID |
@@ -17,7 +17,7 @@ |
||
17 | 17 | public function dropForeignIfExists($index, Connection $connection = null) |
18 | 18 | { |
19 | 19 | // Drop the Foreign Key if it exists |
20 | - if($this->foreignExists($index, $connection)) { |
|
20 | + if ($this->foreignExists($index, $connection)) { |
|
21 | 21 | return $this->dropForeign($index); |
22 | 22 | } |
23 | 23 |
@@ -17,10 +17,10 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function timestampsBy($table = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
19 | 19 | { |
20 | - // Add the 'created_by_id' Reference |
|
20 | + // Add the 'created_by_id' Reference |
|
21 | 21 | $this->createdBy($table, $local, $name, $onUpdate, $onDelete); |
22 | 22 | |
23 | - // Add the 'updated_by_id' Reference |
|
23 | + // Add the 'updated_by_id' Reference |
|
24 | 24 | $this->updatedBy($table, $local, $name, $onUpdate, $onDelete); |
25 | 25 | } |
26 | 26 | |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | } |
96 | 96 | |
97 | 97 | // Create the Belongs to Relation |
98 | - return $this->belongsTo($table, 'created_by_id', $local, $name, $onUpdate, $onDelete)->nullable(); |
|
98 | + return $this->belongsTo($table, 'created_by_id', $local, $name, $onUpdate, $onDelete)->nullable(); |
|
99 | 99 | } |
100 | 100 | |
101 | 101 | /** |
@@ -177,7 +177,7 @@ discard block |
||
177 | 177 | } |
178 | 178 | |
179 | 179 | // Create the Belongs to Relation |
180 | - return $this->belongsTo($table, 'updated_by_id', $local, $name, $onUpdate, $onDelete)->nullable(); |
|
180 | + return $this->belongsTo($table, 'updated_by_id', $local, $name, $onUpdate, $onDelete)->nullable(); |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | /** |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | public function createdBy($table = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
91 | 91 | { |
92 | 92 | // Determine the Table |
93 | - if(is_null($table)) { |
|
93 | + if (is_null($table)) { |
|
94 | 94 | $table = $this->getTimestampsByTable(); |
95 | 95 | } |
96 | 96 | |
@@ -131,7 +131,7 @@ discard block |
||
131 | 131 | public function bigCreatedBy($table = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
132 | 132 | { |
133 | 133 | // Determine the Table |
134 | - if(is_null($table)) { |
|
134 | + if (is_null($table)) { |
|
135 | 135 | $table = $this->getTimestampsByTable(); |
136 | 136 | } |
137 | 137 | |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function updatedBy($table = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
173 | 173 | { |
174 | 174 | // Determine the Table |
175 | - if(is_null($table)) { |
|
175 | + if (is_null($table)) { |
|
176 | 176 | $table = $this->getTimestampsByTable(); |
177 | 177 | } |
178 | 178 | |
@@ -213,7 +213,7 @@ discard block |
||
213 | 213 | public function bigUpdatedBy($table = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
214 | 214 | { |
215 | 215 | // Determine the Table |
216 | - if(is_null($table)) { |
|
216 | + if (is_null($table)) { |
|
217 | 217 | $table = $this->getTimestampsByTable(); |
218 | 218 | } |
219 | 219 |
@@ -7,8 +7,8 @@ discard block |
||
7 | 7 | trait BelongsTo |
8 | 8 | { |
9 | 9 | /** |
10 | - * Defines a Belongs To Column and Relationship. |
|
11 | - * |
|
10 | + * Defines a Belongs To Column and Relationship. |
|
11 | + * |
|
12 | 12 | * @param string $table |
13 | 13 | * @param string|null $foreign |
14 | 14 | * @param string|null $local |
@@ -17,27 +17,27 @@ discard block |
||
17 | 17 | * @param string|null $onDelete |
18 | 18 | * |
19 | 19 | * @return \Illuminate\Support\Fluent |
20 | - */ |
|
20 | + */ |
|
21 | 21 | public function belongsTo($table, $foreign = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
22 | 22 | { |
23 | - // Determine the Name of the Foreign Key |
|
24 | - if(is_null($foreign)) { |
|
25 | - $foreign = Str::singular($table) . '_id'; |
|
26 | - } |
|
23 | + // Determine the Name of the Foreign Key |
|
24 | + if(is_null($foreign)) { |
|
25 | + $foreign = Str::singular($table) . '_id'; |
|
26 | + } |
|
27 | 27 | |
28 | - // Define the Column |
|
29 | - $column = $this->belongsToColumn($foreign); |
|
28 | + // Define the Column |
|
29 | + $column = $this->belongsToColumn($foreign); |
|
30 | 30 | |
31 | - // Define the Relation |
|
32 | - $this->belongsToForeign($table, $foreign, $local, $name, $onUpdate, $onDelete); |
|
31 | + // Define the Relation |
|
32 | + $this->belongsToForeign($table, $foreign, $local, $name, $onUpdate, $onDelete); |
|
33 | 33 | |
34 | - // Return the Column |
|
35 | - return $column; |
|
34 | + // Return the Column |
|
35 | + return $column; |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | /** |
39 | - * Defines a Belongs To Column and Relationship using a Big Integer. |
|
40 | - * |
|
39 | + * Defines a Belongs To Column and Relationship using a Big Integer. |
|
40 | + * |
|
41 | 41 | * @param string $table |
42 | 42 | * @param string|null $foreign |
43 | 43 | * @param string|null $local |
@@ -46,22 +46,22 @@ discard block |
||
46 | 46 | * @param string|null $onDelete |
47 | 47 | * |
48 | 48 | * @return \Illuminate\Support\Fluent |
49 | - */ |
|
49 | + */ |
|
50 | 50 | public function bigBelongsTo($table, $foreign = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
51 | 51 | { |
52 | - // Determine the Name of the Foreign Key |
|
53 | - if(is_null($foreign)) { |
|
54 | - $foreign = Str::singular($table) . '_id'; |
|
55 | - } |
|
52 | + // Determine the Name of the Foreign Key |
|
53 | + if(is_null($foreign)) { |
|
54 | + $foreign = Str::singular($table) . '_id'; |
|
55 | + } |
|
56 | 56 | |
57 | - // Define the Column |
|
58 | - $column = $this->bigBelongsToColumn($foreign); |
|
57 | + // Define the Column |
|
58 | + $column = $this->bigBelongsToColumn($foreign); |
|
59 | 59 | |
60 | - // Define the Relation |
|
60 | + // Define the Relation |
|
61 | 61 | $this->belongsToForeign($table, $foreign, $local, $name, $onUpdate, $onDelete); |
62 | 62 | |
63 | - // Return the Column |
|
64 | - return $column; |
|
63 | + // Return the Column |
|
64 | + return $column; |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -21,7 +21,7 @@ discard block |
||
21 | 21 | public function belongsTo($table, $foreign = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
22 | 22 | { |
23 | 23 | // Determine the Name of the Foreign Key |
24 | - if(is_null($foreign)) { |
|
24 | + if (is_null($foreign)) { |
|
25 | 25 | $foreign = Str::singular($table) . '_id'; |
26 | 26 | } |
27 | 27 | |
@@ -50,7 +50,7 @@ discard block |
||
50 | 50 | public function bigBelongsTo($table, $foreign = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
51 | 51 | { |
52 | 52 | // Determine the Name of the Foreign Key |
53 | - if(is_null($foreign)) { |
|
53 | + if (is_null($foreign)) { |
|
54 | 54 | $foreign = Str::singular($table) . '_id'; |
55 | 55 | } |
56 | 56 | |
@@ -108,22 +108,22 @@ discard block |
||
108 | 108 | public function belongsToForeign($table, $foreign = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
109 | 109 | { |
110 | 110 | // Determine the Name of the Foreign Key |
111 | - if(is_null($foreign)) { |
|
111 | + if (is_null($foreign)) { |
|
112 | 112 | $foreign = Str::singular($table) . '_id'; |
113 | 113 | } |
114 | 114 | |
115 | 115 | // Determine the Name of the Local Key |
116 | - if(is_null($local)) { |
|
116 | + if (is_null($local)) { |
|
117 | 117 | $local = 'id'; |
118 | 118 | } |
119 | 119 | |
120 | 120 | // Determine the Update Constraint |
121 | - if(is_null($onUpdate)) { |
|
121 | + if (is_null($onUpdate)) { |
|
122 | 122 | $onUpdate = $this->getConfig('belongsTo.onUpdate'); |
123 | 123 | } |
124 | 124 | |
125 | 125 | // Determine the Delete Constraint |
126 | - if(is_null($onDelete)) { |
|
126 | + if (is_null($onDelete)) { |
|
127 | 127 | $onDelete = $this->getConfig('belongsTo.onDelete'); |
128 | 128 | } |
129 | 129 | |
@@ -144,7 +144,7 @@ discard block |
||
144 | 144 | public function dropBelongsTo($table, $foreign = null, $local = null, $name = null) |
145 | 145 | { |
146 | 146 | // Determine the Name of the Foreign Key |
147 | - if(is_null($foreign)) { |
|
147 | + if (is_null($foreign)) { |
|
148 | 148 | $foreign = Str::singular($table) . '_id'; |
149 | 149 | } |
150 | 150 | |
@@ -180,17 +180,17 @@ discard block |
||
180 | 180 | public function dropBelongsToForeign($table, $foreign = null, $local = null, $name = null) |
181 | 181 | { |
182 | 182 | // Check for a Name |
183 | - if(!is_null($name)) { |
|
183 | + if (!is_null($name)) { |
|
184 | 184 | return $this->dropForeign($name); |
185 | 185 | } |
186 | 186 | |
187 | 187 | // Determine the Name of the Foreign Key |
188 | - if(is_null($foreign)) { |
|
188 | + if (is_null($foreign)) { |
|
189 | 189 | $foreign = Str::singular($table) . '_id'; |
190 | 190 | } |
191 | 191 | |
192 | 192 | // Determine the Name of the Local Key |
193 | - if(is_null($local)) { |
|
193 | + if (is_null($local)) { |
|
194 | 194 | $local = 'id'; |
195 | 195 | } |
196 | 196 |
@@ -6,15 +6,15 @@ |
||
6 | 6 | |
7 | 7 | trait Columns |
8 | 8 | { |
9 | - /** |
|
10 | - * Creates and returns a new collection of Columns. |
|
11 | - * |
|
12 | - * @param mixed $columns |
|
13 | - * |
|
14 | - * @return \Reed\Blueprints\Columns |
|
15 | - */ |
|
16 | - public function newColumns($columns = []) |
|
17 | - { |
|
18 | - return new ColumnCollection($columns); |
|
19 | - } |
|
9 | + /** |
|
10 | + * Creates and returns a new collection of Columns. |
|
11 | + * |
|
12 | + * @param mixed $columns |
|
13 | + * |
|
14 | + * @return \Reed\Blueprints\Columns |
|
15 | + */ |
|
16 | + public function newColumns($columns = []) |
|
17 | + { |
|
18 | + return new ColumnCollection($columns); |
|
19 | + } |
|
20 | 20 | } |
21 | 21 | \ No newline at end of file |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | public function softDeletesBy($table = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
19 | 19 | { |
20 | - return $this->deletedBy($table, $local, $name, $onUpdate, $onDelete); |
|
20 | + return $this->deletedBy($table, $local, $name, $onUpdate, $onDelete); |
|
21 | 21 | } |
22 | 22 | |
23 | 23 | /** |
@@ -79,7 +79,7 @@ discard block |
||
79 | 79 | } |
80 | 80 | |
81 | 81 | // Create the Belongs to Relation |
82 | - return $this->belongsTo($table, 'deleted_by_id', $local, $name, $onUpdate, $onDelete)->nullable(); |
|
82 | + return $this->belongsTo($table, 'deleted_by_id', $local, $name, $onUpdate, $onDelete)->nullable(); |
|
83 | 83 | } |
84 | 84 | |
85 | 85 | /** |
@@ -74,7 +74,7 @@ discard block |
||
74 | 74 | public function deletedBy($table = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
75 | 75 | { |
76 | 76 | // Determine the Table |
77 | - if(is_null($table)) { |
|
77 | + if (is_null($table)) { |
|
78 | 78 | $table = $this->getTimestampsByTable(); |
79 | 79 | } |
80 | 80 | |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | public function bigDeletedBy($table = null, $local = null, $name = null, $onUpdate = null, $onDelete = null) |
116 | 116 | { |
117 | 117 | // Determine the Table |
118 | - if(is_null($table)) { |
|
118 | + if (is_null($table)) { |
|
119 | 119 | $table = $this->getTimestampsByTable(); |
120 | 120 | } |
121 | 121 |
@@ -16,18 +16,18 @@ discard block |
||
16 | 16 | */ |
17 | 17 | public function foreign($columns, $name = null, $on = null) |
18 | 18 | { |
19 | - // Index the Foreign Key |
|
20 | - $index = $this->indexCommand('foreign', $columns, $name, $on); |
|
19 | + // Index the Foreign Key |
|
20 | + $index = $this->indexCommand('foreign', $columns, $name, $on); |
|
21 | 21 | |
22 | - // Automatically Reference ID |
|
23 | - $index->references('id'); |
|
22 | + // Automatically Reference ID |
|
23 | + $index->references('id'); |
|
24 | 24 | |
25 | - // Declare ON if specified |
|
26 | - if(!is_null($on)) { |
|
27 | - $index->on($on); |
|
28 | - } |
|
25 | + // Declare ON if specified |
|
26 | + if(!is_null($on)) { |
|
27 | + $index->on($on); |
|
28 | + } |
|
29 | 29 | |
30 | - // Return the Index |
|
30 | + // Return the Index |
|
31 | 31 | return $index; |
32 | 32 | } |
33 | 33 | |
@@ -65,59 +65,59 @@ discard block |
||
65 | 65 | */ |
66 | 66 | protected function createIndexName($type, array $columns, $foreign = null) |
67 | 67 | { |
68 | - // Determine the Type Abbreviation |
|
69 | - $abbreviation = $this->createIndexTypeName($type); |
|
68 | + // Determine the Type Abbreviation |
|
69 | + $abbreviation = $this->createIndexTypeName($type); |
|
70 | 70 | |
71 | - // Determine the Foreign Key Table Reference |
|
72 | - if($type == 'foreign' && is_null($foreign)) { |
|
73 | - $foreign = $this->createForeignIndexName($columns); |
|
74 | - } |
|
71 | + // Determine the Foreign Key Table Reference |
|
72 | + if($type == 'foreign' && is_null($foreign)) { |
|
73 | + $foreign = $this->createForeignIndexName($columns); |
|
74 | + } |
|
75 | 75 | |
76 | - // Convert the Columns |
|
77 | - $columns = implode('_', $columns); |
|
76 | + // Convert the Columns |
|
77 | + $columns = implode('_', $columns); |
|
78 | 78 | |
79 | - // Determine the Index Name |
|
80 | - if(isset($foreign)) { |
|
81 | - $index = $abbreviation . strtolower("_{$this->table}_{$foreign}_{$columns}"); |
|
82 | - } else { |
|
83 | - $index = $abbreviation . strtolower("_{$this->table}_{$columns}"); |
|
84 | - } |
|
79 | + // Determine the Index Name |
|
80 | + if(isset($foreign)) { |
|
81 | + $index = $abbreviation . strtolower("_{$this->table}_{$foreign}_{$columns}"); |
|
82 | + } else { |
|
83 | + $index = $abbreviation . strtolower("_{$this->table}_{$columns}"); |
|
84 | + } |
|
85 | 85 | |
86 | - // Replace Illegal Characters |
|
86 | + // Replace Illegal Characters |
|
87 | 87 | return str_replace(['-', '.'], '_', $index); |
88 | 88 | } |
89 | 89 | |
90 | 90 | /** |
91 | - * Returns the Index Type Abbreviation for the specified Type. |
|
92 | - * |
|
93 | - * @param string $type |
|
94 | - * |
|
95 | - * @return string |
|
91 | + * Returns the Index Type Abbreviation for the specified Type. |
|
92 | + * |
|
93 | + * @param string $type |
|
94 | + * |
|
95 | + * @return string |
|
96 | 96 | */ |
97 | 97 | protected function createIndexTypeName($type) |
98 | 98 | { |
99 | - // Convert Type to Abbreviation |
|
100 | - switch($type) { |
|
99 | + // Convert Type to Abbreviation |
|
100 | + switch($type) { |
|
101 | 101 | |
102 | - // Primary Key |
|
103 | - case 'primary': |
|
104 | - return 'PK'; |
|
102 | + // Primary Key |
|
103 | + case 'primary': |
|
104 | + return 'PK'; |
|
105 | 105 | |
106 | - // Unique Key |
|
107 | - case 'unique': |
|
108 | - return 'UX'; |
|
106 | + // Unique Key |
|
107 | + case 'unique': |
|
108 | + return 'UX'; |
|
109 | 109 | |
110 | - // Foreign Key |
|
111 | - case 'foreign': |
|
112 | - return 'FK'; |
|
110 | + // Foreign Key |
|
111 | + case 'foreign': |
|
112 | + return 'FK'; |
|
113 | 113 | |
114 | - // General Index |
|
115 | - case 'index': |
|
116 | - return 'IX'; |
|
117 | - } |
|
114 | + // General Index |
|
115 | + case 'index': |
|
116 | + return 'IX'; |
|
117 | + } |
|
118 | 118 | |
119 | - // Unknown Type |
|
120 | - return $type; |
|
119 | + // Unknown Type |
|
120 | + return $type; |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | /** |
@@ -129,22 +129,22 @@ discard block |
||
129 | 129 | */ |
130 | 130 | protected function createForeignIndexName(array $columns) |
131 | 131 | { |
132 | - // Initialize the List of Tables |
|
133 | - $tables = []; |
|
132 | + // Initialize the List of Tables |
|
133 | + $tables = []; |
|
134 | 134 | |
135 | - // Determine the Tables being References |
|
136 | - foreach($columns as $column) { |
|
135 | + // Determine the Tables being References |
|
136 | + foreach($columns as $column) { |
|
137 | 137 | |
138 | - // Derive the Table Name from the Column |
|
139 | - $table = $this->getTableNameFromColumn($column); |
|
138 | + // Derive the Table Name from the Column |
|
139 | + $table = $this->getTableNameFromColumn($column); |
|
140 | 140 | |
141 | - // Use the Table Name, or the Column if one couldn't be found |
|
142 | - $tables[] = !is_null($table) ? $table : $column; |
|
141 | + // Use the Table Name, or the Column if one couldn't be found |
|
142 | + $tables[] = !is_null($table) ? $table : $column; |
|
143 | 143 | |
144 | - } |
|
144 | + } |
|
145 | 145 | |
146 | - // Flatten the Array |
|
147 | - return implode('_', $tables); |
|
146 | + // Flatten the Array |
|
147 | + return implode('_', $tables); |
|
148 | 148 | } |
149 | 149 | |
150 | 150 | /** |
@@ -156,18 +156,18 @@ discard block |
||
156 | 156 | */ |
157 | 157 | protected function getTableNameFromColumn($column) |
158 | 158 | { |
159 | - // Make sure the Table has an ID Suffix |
|
160 | - if(!Str::endsWith($column, '_id')) { |
|
161 | - return null; |
|
162 | - } |
|
159 | + // Make sure the Table has an ID Suffix |
|
160 | + if(!Str::endsWith($column, '_id')) { |
|
161 | + return null; |
|
162 | + } |
|
163 | 163 | |
164 | - // Strip the '_id' Suffix |
|
165 | - $column = substr($column, 0, -3); |
|
164 | + // Strip the '_id' Suffix |
|
165 | + $column = substr($column, 0, -3); |
|
166 | 166 | |
167 | - // Pluralize the Column Name |
|
168 | - $column = Str::plural($column); |
|
167 | + // Pluralize the Column Name |
|
168 | + $column = Str::plural($column); |
|
169 | 169 | |
170 | - // Use the Plural form of the ID-less Column Name as the Table Name |
|
171 | - return $column; |
|
170 | + // Use the Plural form of the ID-less Column Name as the Table Name |
|
171 | + return $column; |
|
172 | 172 | } |
173 | 173 | } |
174 | 174 | \ No newline at end of file |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | $index->references('id'); |
24 | 24 | |
25 | 25 | // Declare ON if specified |
26 | - if(!is_null($on)) { |
|
26 | + if (!is_null($on)) { |
|
27 | 27 | $index->on($on); |
28 | 28 | } |
29 | 29 | |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $abbreviation = $this->createIndexTypeName($type); |
70 | 70 | |
71 | 71 | // Determine the Foreign Key Table Reference |
72 | - if($type == 'foreign' && is_null($foreign)) { |
|
72 | + if ($type == 'foreign' && is_null($foreign)) { |
|
73 | 73 | $foreign = $this->createForeignIndexName($columns); |
74 | 74 | } |
75 | 75 | |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | $columns = implode('_', $columns); |
78 | 78 | |
79 | 79 | // Determine the Index Name |
80 | - if(isset($foreign)) { |
|
80 | + if (isset($foreign)) { |
|
81 | 81 | $index = $abbreviation . strtolower("_{$this->table}_{$foreign}_{$columns}"); |
82 | 82 | } else { |
83 | 83 | $index = $abbreviation . strtolower("_{$this->table}_{$columns}"); |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | protected function createIndexTypeName($type) |
98 | 98 | { |
99 | 99 | // Convert Type to Abbreviation |
100 | - switch($type) { |
|
100 | + switch ($type) { |
|
101 | 101 | |
102 | 102 | // Primary Key |
103 | 103 | case 'primary': |
@@ -133,7 +133,7 @@ discard block |
||
133 | 133 | $tables = []; |
134 | 134 | |
135 | 135 | // Determine the Tables being References |
136 | - foreach($columns as $column) { |
|
136 | + foreach ($columns as $column) { |
|
137 | 137 | |
138 | 138 | // Derive the Table Name from the Column |
139 | 139 | $table = $this->getTableNameFromColumn($column); |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | protected function getTableNameFromColumn($column) |
158 | 158 | { |
159 | 159 | // Make sure the Table has an ID Suffix |
160 | - if(!Str::endsWith($column, '_id')) { |
|
160 | + if (!Str::endsWith($column, '_id')) { |
|
161 | 161 | return null; |
162 | 162 | } |
163 | 163 |
@@ -18,12 +18,12 @@ discard block |
||
18 | 18 | */ |
19 | 19 | public static function connection($name) |
20 | 20 | { |
21 | - // Create the schema builder |
|
21 | + // Create the schema builder |
|
22 | 22 | $schema = parent::connection($name); |
23 | 23 | |
24 | 24 | // Use the custom blueprint |
25 | 25 | $schema->blueprintResolver(function($table, $callback) { |
26 | - return new Blueprint($table, $callback); |
|
26 | + return new Blueprint($table, $callback); |
|
27 | 27 | }); |
28 | 28 | |
29 | 29 | // Return the schema |
@@ -37,12 +37,12 @@ discard block |
||
37 | 37 | */ |
38 | 38 | protected static function getFacadeAccessor() |
39 | 39 | { |
40 | - // Create the schema builder |
|
40 | + // Create the schema builder |
|
41 | 41 | $schema = parent::getFacadeAccessor(); |
42 | 42 | |
43 | 43 | // Use the custom blueprint |
44 | 44 | $schema->blueprintResolver(function($table, $callback) { |
45 | - return new Blueprint($table, $callback); |
|
45 | + return new Blueprint($table, $callback); |
|
46 | 46 | }); |
47 | 47 | |
48 | 48 | // Return the schema |
@@ -23,11 +23,11 @@ discard block |
||
23 | 23 | */ |
24 | 24 | public function __construct($columns = []) |
25 | 25 | { |
26 | - // Call Parent Constructor |
|
27 | - parent::__construct($columns); |
|
26 | + // Call Parent Constructor |
|
27 | + parent::__construct($columns); |
|
28 | 28 | |
29 | - // Set the Blueprint |
|
30 | - $this->blueprint = $this->guessBlueprint(); |
|
29 | + // Set the Blueprint |
|
30 | + $this->blueprint = $this->guessBlueprint(); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -37,7 +37,7 @@ discard block |
||
37 | 37 | */ |
38 | 38 | public function getBlueprint() |
39 | 39 | { |
40 | - return $this->blueprint; |
|
40 | + return $this->blueprint; |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | /** |
@@ -49,9 +49,9 @@ discard block |
||
49 | 49 | */ |
50 | 50 | public function setBlueprint(Blueprint $blueprint) |
51 | 51 | { |
52 | - $this->blueprint = $blueprint; |
|
52 | + $this->blueprint = $blueprint; |
|
53 | 53 | |
54 | - return $this; |
|
54 | + return $this; |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -61,21 +61,21 @@ discard block |
||
61 | 61 | */ |
62 | 62 | protected function guessBlueprint() |
63 | 63 | { |
64 | - // Determine the Caller |
|
65 | - [$one, $two, $caller] = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); |
|
64 | + // Determine the Caller |
|
65 | + [$one, $two, $caller] = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); |
|
66 | 66 | |
67 | - // Check for Blueprint Caller |
|
68 | - if($caller['object'] instanceof Blueprint) { |
|
67 | + // Check for Blueprint Caller |
|
68 | + if($caller['object'] instanceof Blueprint) { |
|
69 | 69 | return $caller['object']; |
70 | - } |
|
70 | + } |
|
71 | 71 | |
72 | - // Check for Columns Caller |
|
73 | - if($caller['object'] instanceof static) { |
|
72 | + // Check for Columns Caller |
|
73 | + if($caller['object'] instanceof static) { |
|
74 | 74 | return $caller['object']->getBlueprint(); |
75 | - } |
|
75 | + } |
|
76 | 76 | |
77 | - // Unknown Caller |
|
78 | - return null; |
|
77 | + // Unknown Caller |
|
78 | + return null; |
|
79 | 79 | } |
80 | 80 | |
81 | 81 | /** |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | */ |
102 | 102 | public function __call($method, $parameters) |
103 | 103 | { |
104 | - // Check for Macro |
|
104 | + // Check for Macro |
|
105 | 105 | if(static::hasMacro($method)) { |
106 | 106 | return parent::__call($method, $parameters); |
107 | 107 | } |
@@ -65,12 +65,12 @@ discard block |
||
65 | 65 | [$one, $two, $caller] = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT, 3); |
66 | 66 | |
67 | 67 | // Check for Blueprint Caller |
68 | - if($caller['object'] instanceof Blueprint) { |
|
68 | + if ($caller['object'] instanceof Blueprint) { |
|
69 | 69 | return $caller['object']; |
70 | 70 | } |
71 | 71 | |
72 | 72 | // Check for Columns Caller |
73 | - if($caller['object'] instanceof static) { |
|
73 | + if ($caller['object'] instanceof static) { |
|
74 | 74 | return $caller['object']->getBlueprint(); |
75 | 75 | } |
76 | 76 | |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | public function __call($method, $parameters) |
103 | 103 | { |
104 | 104 | // Check for Macro |
105 | - if(static::hasMacro($method)) { |
|
105 | + if (static::hasMacro($method)) { |
|
106 | 106 | return parent::__call($method, $parameters); |
107 | 107 | } |
108 | 108 |