Okay, I found a "solution":
--- ./vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php.bak 2017-06-07 09:22:30.072124838 +0200
+++ ./vendor/laravel/framework/src/Illuminate/Database/Eloquent/Relations/HasOneOrMany.php 2017-06-07 09:24:24.353116784 +0200
@@ -116,7 +116,7 @@
// link them up with their children using the keyed dictionary to make the
// matching very convenient and easy work. Then we'll just return them.
foreach ($models as $model) {
- if (isset($dictionary[$key = $model->getAttribute($this->localKey)])) {
+ if (isset($dictionary[$key = strtoupper($model->getAttribute($this->localKey))])) {
$model->setRelation(
$relation, $this->getRelationValue($dictionary, $key, $type)
);
@@ -157,7 +157,7 @@
// relationship as this will allow us to quickly access all of the related
// models without having to do nested looping which will be quite slow.
foreach ($results as $result) {
- $dictionary[$result->{$foreign}][] = $result;
+ $dictionary[strtoupper($result->{$foreign})][] = $result;
}
return $dictionary;
With that solution, foreign key isn't longer case sensitive. Any pros and cons for that? Make that sense?
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community