Skip to content

Commit 15f262e

Browse files
committed
Merge branch '5.7'
2 parents 147b7e6 + 578bc83 commit 15f262e

File tree

5 files changed

+39
-5
lines changed

5 files changed

+39
-5
lines changed

src/Illuminate/Foundation/Application.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -891,7 +891,7 @@ public function configurationIsCached()
891891
*/
892892
public function getCachedConfigPath()
893893
{
894-
return $this->bootstrapPath().'/cache/config.php';
894+
return $_ENV['APP_CONFIG_CACHE'] ?? $this->bootstrapPath().'/cache/config.php';
895895
}
896896

897897
/**

src/Illuminate/Foundation/Console/ConfigCacheCommand.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ public function handle()
5656
$this->call('config:clear');
5757

5858
$config = $this->getFreshConfiguration();
59+
5960
$configPath = $this->laravel->getCachedConfigPath();
6061

6162
$this->files->put(

src/Illuminate/Mail/TransportManager.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Aws\Ses\SesClient;
66
use Illuminate\Support\Arr;
77
use Psr\Log\LoggerInterface;
8+
use Illuminate\Log\LogManager;
89
use Illuminate\Support\Manager;
910
use GuzzleHttp\Client as HttpClient;
1011
use Swift_SmtpTransport as SmtpTransport;
@@ -159,11 +160,13 @@ protected function createSparkPostDriver()
159160
*/
160161
protected function createLogDriver()
161162
{
162-
$channel = $this->app['config']['mail.log_channel'];
163+
$logger = $this->app->make(LoggerInterface::class);
163164

164-
return new LogTransport(
165-
$this->app->make(LoggerInterface::class)->channel($channel)
166-
);
165+
if ($logger instanceof LogManager) {
166+
$logger = $logger->channel($this->app['config']['mail.log_channel']);
167+
}
168+
169+
return new LogTransport($logger);
167170
}
168171

169172
/**

src/Illuminate/Validation/Concerns/ReplacesAttributes.php

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -469,4 +469,22 @@ protected function replaceDimensions($message, $attribute, $rule, $parameters)
469469

470470
return $message;
471471
}
472+
473+
/**
474+
* Replace all place-holders for the starts_with rule.
475+
*
476+
* @param string $message
477+
* @param string $attribute
478+
* @param string $rule
479+
* @param array $parameters
480+
* @return string
481+
*/
482+
protected function replaceStartsWith($message, $attribute, $rule, $parameters)
483+
{
484+
foreach ($parameters as &$parameter) {
485+
$parameter = $this->getDisplayableValue($attribute, $parameter);
486+
}
487+
488+
return str_replace(':values', implode(', ', $parameters), $message);
489+
}
472490
}

tests/Validation/ValidationValidatorTest.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1214,6 +1214,18 @@ public function testValidateStartsWith()
12141214
$trans = $this->getIlluminateArrayTranslator();
12151215
$v = new Validator($trans, ['x' => 'hello world'], ['x' => 'starts_with:world,hello']);
12161216
$this->assertTrue($v->passes());
1217+
1218+
$trans = $this->getIlluminateArrayTranslator();
1219+
$trans->addLines(['validation.starts_with' => 'The :attribute must start with one of the following values :values'], 'en');
1220+
$v = new Validator($trans, ['url' => 'laravel.com'], ['url' => 'starts_with:http']);
1221+
$this->assertFalse($v->passes());
1222+
$this->assertEquals('The url must start with one of the following values http', $v->messages()->first('url'));
1223+
1224+
$trans = $this->getIlluminateArrayTranslator();
1225+
$trans->addLines(['validation.starts_with' => 'The :attribute must start with one of the following values :values'], 'en');
1226+
$v = new Validator($trans, ['url' => 'laravel.com'], ['url' => 'starts_with:http,https']);
1227+
$this->assertFalse($v->passes());
1228+
$this->assertEquals('The url must start with one of the following values http, https', $v->messages()->first('url'));
12171229
}
12181230

12191231
public function testValidateString()

0 commit comments

Comments
 (0)