Skip to content

Commit f8cde32

Browse files
committed
Merge branch '7.x' into 8.x
2 parents 9141ccd + d6d83f2 commit f8cde32

File tree

10 files changed

+27
-17
lines changed

10 files changed

+27
-17
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<p align="center"><a href="https://laravel.com" target="_blank" rel="noopener"><img src="https://res.cloudinary.com/dtfbvvkyp/image/upload/v1566331377/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
1+
<p align="center"><a href="https://laravel.com" target="_blank"><img src="https://raw.githubusercontent.com/laravel/art/master/logo-lockup/5%20SVG/2%20CMYK/1%20Full%20Color/laravel-logolockup-cmyk-red.svg" width="400"></a></p>
22

33
<p align="center">
44
<a href="https://github.com/laravel/framework/actions"><img src="https://github.com/laravel/framework/workflows/tests/badge.svg" alt="Build Status"></a>

src/Illuminate/Contracts/Database/Eloquent/CastsAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public function get($model, string $key, $value, array $attributes);
2222
* @param string $key
2323
* @param mixed $value
2424
* @param array $attributes
25-
* @return array|string
25+
* @return mixed
2626
*/
2727
public function set($model, string $key, $value, array $attributes);
2828
}

src/Illuminate/Contracts/Database/Eloquent/CastsInboundAttributes.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ interface CastsInboundAttributes
1111
* @param string $key
1212
* @param mixed $value
1313
* @param array $attributes
14-
* @return array
14+
* @return mixed
1515
*/
1616
public function set($model, string $key, $value, array $attributes);
1717
}

src/Illuminate/Contracts/Debug/ExceptionHandler.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ interface ExceptionHandler
1212
* @param \Throwable $e
1313
* @return void
1414
*
15-
* @throws \Exception
15+
* @throws \Throwable
1616
*/
1717
public function report(Throwable $e);
1818

src/Illuminate/Database/Connectors/Connector.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ class Connector
3333
* @param array $options
3434
* @return \PDO
3535
*
36-
* @throws \Throwable
36+
* @throws \Exception
3737
*/
3838
public function createConnection($dsn, array $config, array $options)
3939
{
@@ -92,7 +92,7 @@ protected function isPersistentConnection($options)
9292
* @param array $options
9393
* @return \PDO
9494
*
95-
* @throws \Throwable
95+
* @throws \Exception
9696
*/
9797
protected function tryAgainIfCausedByLostConnection(Throwable $e, $dsn, $username, $password, $options)
9898
{

src/Illuminate/Database/Eloquent/Collection.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -79,19 +79,18 @@ public function loadCount($relations)
7979
->whereKey($this->modelKeys())
8080
->select($this->first()->getKeyName())
8181
->withCount(...func_get_args())
82-
->get();
82+
->get()
83+
->keyBy($this->first()->getKeyName());
8384

8485
$attributes = Arr::except(
8586
array_keys($models->first()->getAttributes()),
8687
$models->first()->getKeyName()
8788
);
8889

89-
$models->each(function ($model) use ($attributes) {
90-
$this->where($this->first()->getKeyName(), $model->getKey())
91-
->each
92-
->forceFill(Arr::only($model->getAttributes(), $attributes))
93-
->each
94-
->syncOriginalAttributes($attributes);
90+
$this->each(function ($model) use ($models, $attributes) {
91+
$extraAttributes = Arr::only($models->get($model->getKey())->getAttributes(), $attributes);
92+
93+
$model->forceFill($extraAttributes)->syncOriginalAttributes($attributes);
9594
});
9695

9796
return $this;
@@ -358,7 +357,7 @@ public function intersect($items)
358357
*
359358
* @param string|callable|null $key
360359
* @param bool $strict
361-
* @return static|\Illuminate\Support\Collection
360+
* @return static
362361
*/
363362
public function unique($key = null, $strict = false)
364363
{

src/Illuminate/Database/Schema/Grammars/SqlServerGrammar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public function compileColumnListing($table)
4848
{
4949
return "select col.name from sys.columns as col
5050
join sys.objects as obj on col.object_id = obj.object_id
51-
where obj.type = 'U' and obj.name = '$table'";
51+
where obj.type = 'U' and obj.object_id = object_id('$table')";
5252
}
5353

5454
/**

src/Illuminate/Http/Client/PendingRequest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -525,7 +525,7 @@ public function delete($url, $data = [])
525525
* @param array $options
526526
* @return \Illuminate\Http\Client\Response
527527
*
528-
* @throws \Throwable
528+
* @throws \Exception
529529
*/
530530
public function send(string $method, string $url, array $options = [])
531531
{

src/Illuminate/Translation/Translator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ public function get($key, array $replace = [], $locale = null, $fallback = true)
122122
$locales = $fallback ? $this->localeArray($locale) : [$locale];
123123

124124
foreach ($locales as $locale) {
125-
if (! is_null($line = $this->getLine(
125+
if (! empty($line = $this->getLine(
126126
$namespace, $group, $locale, $item, $replace
127127
))) {
128128
return $line ?? $key;

tests/Translation/TranslationTranslatorTest.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ public function testGetMethodProperlyLoadsAndRetrievesItemForFallback()
104104
$this->assertSame('foo', $t->get('foo::bar.foo'));
105105
}
106106

107+
public function testGetMethodProperlyLoadsAndRetrievesItemForFallbackWhenLineIsEmpty()
108+
{
109+
$t = new Translator($this->getLoader(), 'en');
110+
$t->setFallback('lv');
111+
$t->getLoader()->shouldReceive('load')->once()->with('en', '*', '*')->andReturn([]);
112+
$t->getLoader()->shouldReceive('load')->once()->with('en', 'bar', 'foo')->andReturn(['baz' => '']);
113+
$t->getLoader()->shouldReceive('load')->once()->with('lv', 'bar', 'foo')->andReturn(['foo' => 'foo', 'baz' => 'breeze :foo']);
114+
$this->assertSame('breeze bar', $t->get('foo::bar.baz', ['foo' => 'bar'], 'en'));
115+
$this->assertSame('foo', $t->get('foo::bar.foo'));
116+
}
117+
107118
public function testGetMethodProperlyLoadsAndRetrievesItemForGlobalNamespace()
108119
{
109120
$t = new Translator($this->getLoader(), 'en');

0 commit comments

Comments
 (0)