@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('organizations', function (Blueprint $table) { |
|
| 16 | + Schema::create('organizations', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('organization_id'); |
| 18 | 18 | $table->string('name')->unique(); |
| 19 | 19 | $table->timestamps(); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function up() |
| 13 | 13 | { |
| 14 | - Schema::create('binary_users', function (Blueprint $table) { |
|
| 14 | + Schema::create('binary_users', function(Blueprint $table) { |
|
| 15 | 15 | $table->binary('user_id'); |
| 16 | 16 | $table->unsignedInteger('organization_id'); |
| 17 | 17 | $table->primary(['user_id', 'organization_id']); |
@@ -13,7 +13,7 @@ |
||
| 13 | 13 | */ |
| 14 | 14 | public function up() |
| 15 | 15 | { |
| 16 | - Schema::create('non_composite_users', function (Blueprint $table) { |
|
| 16 | + Schema::create('non_composite_users', function(Blueprint $table) { |
|
| 17 | 17 | $table->increments('user_id'); |
| 18 | 18 | $table->unsignedInteger('organization_id'); |
| 19 | 19 | $table->string('name')->unique(); |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | protected function getEnvironmentSetUp($app) |
| 12 | 12 | { |
| 13 | 13 | $app['config']->set('database.default', 'testing'); |
| 14 | - $app['router']->get('binary-users/{binaryUser}', function (TestBinaryUser $binaryUser) { |
|
| 14 | + $app['router']->get('binary-users/{binaryUser}', function(TestBinaryUser $binaryUser) { |
|
| 15 | 15 | return $binaryUser->toJson(); |
| 16 | 16 | })->middleware(SubstituteBindings::class); |
| 17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | protected function getEnvironmentSetUp($app) |
| 12 | 12 | { |
| 13 | 13 | $app['config']->set('database.default', 'testing'); |
| 14 | - $app['router']->get('non-composite-users/{testUserNonComposite}', function (TestUserNonComposite $testUserNonComposite) { |
|
| 14 | + $app['router']->get('non-composite-users/{testUserNonComposite}', function(TestUserNonComposite $testUserNonComposite) { |
|
| 15 | 15 | return $testUserNonComposite->setHidden(['created_at', 'updated_at'])->toJson(); |
| 16 | 16 | })->middleware(SubstituteBindings::class); |
| 17 | 17 | } |
@@ -11,7 +11,7 @@ |
||
| 11 | 11 | */ |
| 12 | 12 | public function up() |
| 13 | 13 | { |
| 14 | - Schema::create('users', function (Blueprint $table) { |
|
| 14 | + Schema::create('users', function(Blueprint $table) { |
|
| 15 | 15 | //primary |
| 16 | 16 | $table->unsignedInteger('user_id'); |
| 17 | 17 | $table->unsignedInteger('organization_id'); |
@@ -35,7 +35,7 @@ |
||
| 35 | 35 | // foreign key name by using the name of the relationship function, which |
| 36 | 36 | // when combined with an "_id" should conventionally match the columns. |
| 37 | 37 | if (is_null($foreignKey)) { |
| 38 | - $foreignKey = is_array($instance->getKeyName()) ? array_map(function ($key) use ($relation) { |
|
| 38 | + $foreignKey = is_array($instance->getKeyName()) ? array_map(function($key) use ($relation) { |
|
| 39 | 39 | return Str::snake($relation).'_'.$key; |
| 40 | 40 | }, $instance->getKeyName()) : Str::snake($relation).'_'.$instance->getKeyName(); |
| 41 | 41 | } |
@@ -46,7 +46,7 @@ discard block |
||
| 46 | 46 | public function getResults() |
| 47 | 47 | { |
| 48 | 48 | $foreignKey = !is_array($this->foreignKey) ? [$this->foreignKey] : $this->foreignKey; |
| 49 | - foreach($foreignKey as $foreignKeyVal) { |
|
| 49 | + foreach ($foreignKey as $foreignKeyVal) { |
|
| 50 | 50 | if (is_null($this->child->{$foreignKeyVal})) { |
| 51 | 51 | return $this->getDefaultFor($this->parent); |
| 52 | 52 | } |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | // We'll grab the primary key name of the related models since it could be set to |
| 70 | 70 | // a non-standard name and not "id". We will then construct the constraint for |
| 71 | 71 | // our eagerly loading query so it returns the proper models from execution. |
| 72 | - (new CompositeKeyScope(array_map(function ($keyName) { |
|
| 72 | + (new CompositeKeyScope(array_map(function($keyName) { |
|
| 73 | 73 | return $this->related->getTable().'.'.$keyName; |
| 74 | 74 | }, $ownerKeys), $this->getEagerModelKeys($models), false, method_exists($this->related, 'getBinaryColumns') ? $this->related->getBinaryColumns() : []))->apply($this->query); |
| 75 | 75 | } |
@@ -150,7 +150,7 @@ discard block |
||
| 150 | 150 | $dictionary = []; |
| 151 | 151 | |
| 152 | 152 | foreach ($results as $result) { |
| 153 | - $dictionary[implode($this->magicKeyDelimiter, array_map(function ($owner) use ($result) { |
|
| 153 | + $dictionary[implode($this->magicKeyDelimiter, array_map(function($owner) use ($result) { |
|
| 154 | 154 | return $result->getAttribute($owner); |
| 155 | 155 | }, $ownerKeys))] = $result; |
| 156 | 156 | } |
@@ -159,7 +159,7 @@ discard block |
||
| 159 | 159 | // and match back onto their children using these keys of the dictionary and |
| 160 | 160 | // the primary key of the children to map them onto the correct instances. |
| 161 | 161 | foreach ($models as $model) { |
| 162 | - $foreignKey = implode($this->magicKeyDelimiter, array_map(function ($foreign) use ($model) { |
|
| 162 | + $foreignKey = implode($this->magicKeyDelimiter, array_map(function($foreign) use ($model) { |
|
| 163 | 163 | return $model->{$foreign}; |
| 164 | 164 | }, $foreignKeys)); |
| 165 | 165 | if (isset($dictionary[$foreignKey])) { |
@@ -50,7 +50,7 @@ |
||
| 50 | 50 | $rawKeys = $this->getRawKey(); |
| 51 | 51 | |
| 52 | 52 | //do not normalize single key because we couldn't detect its type |
| 53 | - if(count($rawKeys) > 1) { |
|
| 53 | + if (count($rawKeys) > 1) { |
|
| 54 | 54 | foreach ($rawKeys as $key => $value) { |
| 55 | 55 | if (in_array($key, $this->getBinaryColumns()) && !$this->hexBinaryColumns()) { |
| 56 | 56 | $rawKeys[$key] = strtoupper(bin2hex($value)); |