Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 723c7a4

Browse files
committed
Merge 4.0.
2 parents c1978b1 + 38fc916 commit 723c7a4

9 files changed

Lines changed: 40 additions & 7 deletions

File tree

src/Illuminate/Database/Query/Builder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -814,6 +814,8 @@ public function orHavingRaw($sql, array $bindings = array())
814814
*/
815815
public function orderBy($column, $direction = 'asc')
816816
{
817+
$direction = strtolower($direction) == 'asc' ? 'asc' : 'desc';
818+
817819
$this->orders[] = compact('column', 'direction');
818820

819821
return $this;
@@ -986,7 +988,7 @@ public function find($id, $columns = array('*'))
986988
}
987989

988990
/**
989-
* Pluck a single column from the database.
991+
* Pluck a single column's value from the first result of a query.
990992
*
991993
* @param string $column
992994
* @return mixed

src/Illuminate/Database/Schema/Builder.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,9 @@ public function hasTable($table)
5656
*/
5757
public function hasColumn($table, $column)
5858
{
59-
return in_array($column, $this->getColumnListing($table));
59+
$column = strtolower($column);
60+
61+
return in_array($column, array_map('strtolower', $this->getColumnListing($table)));
6062
}
6163

6264
/**

src/Illuminate/Foundation/changes.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
{"message": "Added 'shared' method to View to pull a single shared item out.", "backport": null},
7575
{"message": "Added assertHasOldInput test assertion.", "backport": null},
7676
{"message": "Added slick new 'sometimes' method to Validator for conditionally adding rules.", "backport": null},
77-
{"message": "Added new '--sleep' option to queue:listen command to control time between jobs.", "backport": null}
77+
{"message": "Added new '--sleep' option to queue:listen command to control time between jobs.", "backport": null},
78+
{"message": "Allow Blade processing on echos to be escaped using the @ sign.", "backport": null}
7879
]
7980
}

src/Illuminate/Validation/Validator.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,7 @@ public function addImplicitExtensions(array $extensions)
16131613
*/
16141614
public function addExtension($rule, $extension)
16151615
{
1616-
$this->extensions[$rule] = $extension;
1616+
$this->extensions[snake_case($rule)] = $extension;
16171617
}
16181618

16191619
/**

src/Illuminate/View/Compilers/BladeCompiler.php

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,9 +190,14 @@ protected function compileEchos($value)
190190
*/
191191
protected function compileRegularEchos($value)
192192
{
193-
$pattern = sprintf('/%s\s*(.+?)\s*%s/s', $this->contentTags[0], $this->contentTags[1]);
193+
$pattern = sprintf('/(@)?%s\s*(.+?)\s*%s/s', $this->contentTags[0], $this->contentTags[1]);
194194

195-
return preg_replace($pattern, '<?php echo $1; ?>', $value);
195+
$callback = function($matches)
196+
{
197+
return $matches[1] ? substr($matches[0], 1) : '<?php echo '.$matches[2].'; ?>';
198+
};
199+
200+
return preg_replace_callback($pattern, $callback, $value);
196201
}
197202

198203
/**

src/Illuminate/View/Engines/PhpEngine.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function evaluatePath($__path, $__data)
4242
$this->handleViewException($e);
4343
}
4444

45-
return ob_get_clean();
45+
return ltrim(ob_get_clean());
4646
}
4747

4848
/**

tests/Validation/ValidationValidatorTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -799,6 +799,14 @@ public function testCustomValidators()
799799
$this->assertFalse($v->passes());
800800
$v->messages()->setFormat(':message');
801801
$this->assertEquals('foo!', $v->messages()->first('name'));
802+
803+
$trans = $this->getRealTranslator();
804+
$trans->addResource('array', array('validation.foo_bar' => 'foo!'), 'en', 'messages');
805+
$v = new Validator($trans, array('name' => 'taylor'), array('name' => 'foo_bar'));
806+
$v->addExtension('FooBar', function() { return false; });
807+
$this->assertFalse($v->passes());
808+
$v->messages()->setFormat(':message');
809+
$this->assertEquals('foo!', $v->messages()->first('name'));
802810
}
803811

804812

tests/View/ViewBladeCompilerTest.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,20 @@ public function testEchosAreCompiled()
7474
}
7575

7676

77+
public function testEscapedWithAtEchosAreCompiled()
78+
{
79+
$compiler = new BladeCompiler($this->getFiles(), __DIR__);
80+
$this->assertEquals('{{$name}}', $compiler->compileString('@{{$name}}'));
81+
$this->assertEquals('{{ $name }}', $compiler->compileString('@{{ $name }}'));
82+
$this->assertEquals('{{
83+
$name
84+
}}',
85+
$compiler->compileString('@{{
86+
$name
87+
}}'));
88+
}
89+
90+
7791
public function testReversedEchosAreCompiled()
7892
{
7993
$compiler = new BladeCompiler($this->getFiles(), __DIR__);

tests/View/fixtures/basic.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
1+
12
Hello World

0 commit comments

Comments
 (0)