language
stringclasses
1 value
owner
stringlengths
2
15
repo
stringlengths
2
21
sha
stringlengths
45
45
message
stringlengths
7
36.3k
path
stringlengths
1
199
patch
stringlengths
15
102k
is_multipart
bool
2 classes
Other
laravel
framework
b106c76dee0f7f2a40ab7c46428d2e69ed4b4fba.json
Use expectedException annotations in the tests
tests/Http/HttpResponseTest.php
@@ -134,9 +134,11 @@ public function testMagicCall() $response->withFoo('bar'); } + /** + * @expectedException BadMethodCallException + */ public function testMagicCallException() { - $this->setExpectedException('BadMethodCallException'); $response = new RedirectResponse('foo.bar'); $response->doesNotExist('bar'); }
true
Other
laravel
framework
b106c76dee0f7f2a40ab7c46428d2e69ed4b4fba.json
Use expectedException annotations in the tests
tests/Session/SessionStoreTest.php
@@ -28,9 +28,11 @@ public function testSessionIsLoadedFromHandler() $this->assertTrue($session->has('baz')); } + /** + * @expectedException InvalidArgumentException + */ public function testSessionGetBagException() { - $this->setExpectedException('InvalidArgumentException'); $session = $this->getSession(); $session->getBag('doesNotExist'); }
true
Other
laravel
framework
b106c76dee0f7f2a40ab7c46428d2e69ed4b4fba.json
Use expectedException annotations in the tests
tests/View/ViewEngineResolverTest.php
@@ -11,9 +11,11 @@ public function testResolversMayBeResolved() $this->assertEquals(spl_object_hash($result), spl_object_hash($resolver->resolve('foo'))); } + /** + * @expectedException InvalidArgumentException + */ public function testResolverThrowsExceptionOnUnknownEngine() { - $this->setExpectedException('InvalidArgumentException'); $resolver = new Illuminate\View\Engines\EngineResolver; $resolver->resolve('foo'); }
true
Other
laravel
framework
b106c76dee0f7f2a40ab7c46428d2e69ed4b4fba.json
Use expectedException annotations in the tests
tests/View/ViewFactoryTest.php
@@ -373,17 +373,23 @@ public function testMakeWithAlias() $this->assertEquals('real', $view->getName()); } + /** + * @expectedException InvalidArgumentException + */ public function testExceptionIsThrownForUnknownExtension() { - $this->setExpectedException('InvalidArgumentException'); $factory = $this->getFactory(); $factory->getFinder()->shouldReceive('find')->once()->with('view')->andReturn('view.foo'); $factory->make('view'); } + /** + * @expectedException Exception + * @expectedExceptionMessage section exception message + */ public function testExceptionsInSectionsAreThrown() { - $engine = new \Illuminate\View\Engines\CompilerEngine(m::mock('Illuminate\View\Compilers\CompilerInterface')); + $engine = new Illuminate\View\Engines\CompilerEngine(m::mock('Illuminate\View\Compilers\CompilerInterface')); $engine->getCompiler()->shouldReceive('getCompiledPath')->andReturnUsing(function ($path) { return $path; }); $engine->getCompiler()->shouldReceive('isExpired')->twice()->andReturn(false); $factory = $this->getFactory(); @@ -392,27 +398,32 @@ public function testExceptionsInSectionsAreThrown() $factory->getFinder()->shouldReceive('find')->once()->with('view')->andReturn(__DIR__.'/fixtures/section-exception.php'); $factory->getDispatcher()->shouldReceive('fire')->times(4); - $this->setExpectedException('Exception', 'section exception message'); $factory->make('view')->render(); } + /** + * @expectedException InvalidArgumentException + * @expectedExceptionMessage Cannot end a section without first starting one. + */ public function testExtraStopSectionCallThrowsException() { $factory = $this->getFactory(); $factory->startSection('foo'); $factory->stopSection(); - $this->setExpectedException('InvalidArgumentException', 'Cannot end a section without first starting one.'); $factory->stopSection(); } + /** + * @expectedException InvalidArgumentException + * @expectedExceptionMessage Cannot end a section without first starting one. + */ public function testExtraAppendSectionCallThrowsException() { $factory = $this->getFactory(); $factory->startSection('foo'); $factory->stopSection(); - $this->setExpectedException('InvalidArgumentException', 'Cannot end a section without first starting one.'); $factory->appendSection(); }
true
Other
laravel
framework
b106c76dee0f7f2a40ab7c46428d2e69ed4b4fba.json
Use expectedException annotations in the tests
tests/View/ViewTest.php
@@ -148,9 +148,11 @@ public function testViewMagicMethods() $this->assertFalse($view->offsetExists('foo')); } + /** + * @expectedException BadMethodCallException + */ public function testViewBadMethod() { - $this->setExpectedException('BadMethodCallException'); $view = $this->getView(); $view->badMethodCall(); }
true
Other
laravel
framework
073ac37b33dec850627363a6ab950ac9f2fd6474.json
Let a collection a macroable
src/Illuminate/Support/Collection.php
@@ -9,11 +9,14 @@ use JsonSerializable; use IteratorAggregate; use InvalidArgumentException; +use Illuminate\Support\Traits\Macroable; use Illuminate\Contracts\Support\Jsonable; use Illuminate\Contracts\Support\Arrayable; class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate, Jsonable, JsonSerializable { + use Macroable; + /** * The items contained in the collection. *
true
Other
laravel
framework
073ac37b33dec850627363a6ab950ac9f2fd6474.json
Let a collection a macroable
tests/Support/SupportCollectionTest.php
@@ -487,6 +487,22 @@ public function testTakeLast() $this->assertEquals(['dayle', 'shawn'], $data->all()); } + public function testMacroable() + { + // Foo() macro : unique values starting with A + Collection::macro('foo', function () { + return $this->filter(function ($item) { + return strpos($item, 'a') === 0; + }) + ->unique() + ->values(); + }); + + $c = new Collection(['a', 'a', 'aa', 'aaa', 'bar']); + + $this->assertSame(['a', 'aa', 'aaa'], $c->foo()->all()); + } + public function testMakeMethod() { $collection = Collection::make('foo');
true
Other
laravel
framework
44c11585f127764278f979fa04307b805df58792.json
Use namespace imports
tests/Routing/RoutingUrlGeneratorTest.php
@@ -1,15 +1,18 @@ <?php +use Illuminate\Http\Request; +use Illuminate\Routing\Route; use Illuminate\Routing\UrlGenerator; +use Illuminate\Routing\RouteCollection; use Illuminate\Contracts\Routing\UrlRoutable; class RoutingUrlGeneratorTest extends PHPUnit_Framework_TestCase { public function testBasicGeneration() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); $this->assertEquals('http://www.foo.com/foo/bar', $url->to('foo/bar')); @@ -21,8 +24,8 @@ public function testBasicGeneration() * Test HTTPS request URL generation... */ $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('https://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('https://www.foo.com/') ); $this->assertEquals('https://www.foo.com/foo/bar', $url->to('foo/bar')); @@ -31,8 +34,8 @@ public function testBasicGeneration() * Test asset URL generation... */ $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/index.php/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/index.php/') ); $this->assertEquals('http://www.foo.com/foo/bar', $url->asset('foo/bar')); @@ -42,56 +45,56 @@ public function testBasicGeneration() public function testBasicRouteGeneration() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); /* * Empty Named Route */ - $route = new Illuminate\Routing\Route(['GET'], '/', ['as' => 'plain']); + $route = new Route(['GET'], '/', ['as' => 'plain']); $routes->add($route); /* * Named Routes */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar', ['as' => 'foo']); + $route = new Route(['GET'], 'foo/bar', ['as' => 'foo']); $routes->add($route); /* * Parameters... */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar/{baz}/breeze/{boom}', ['as' => 'bar']); + $route = new Route(['GET'], 'foo/bar/{baz}/breeze/{boom}', ['as' => 'bar']); $routes->add($route); /* * Single Parameter... */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar/{baz}', ['as' => 'foobar']); + $route = new Route(['GET'], 'foo/bar/{baz}', ['as' => 'foobar']); $routes->add($route); /* * HTTPS... */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/baz', ['as' => 'baz', 'https']); + $route = new Route(['GET'], 'foo/baz', ['as' => 'baz', 'https']); $routes->add($route); /* * Controller Route Route */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bam', ['controller' => 'foo@bar']); + $route = new Route(['GET'], 'foo/bam', ['controller' => 'foo@bar']); $routes->add($route); /* * Non ASCII routes */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar/åαф/{baz}', ['as' => 'foobarbaz']); + $route = new Route(['GET'], 'foo/bar/åαф/{baz}', ['as' => 'foobarbaz']); $routes->add($route); /* * Fragments */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar#derp', ['as' => 'fragment']); + $route = new Route(['GET'], 'foo/bar#derp', ['as' => 'fragment']); $routes->add($route); $this->assertEquals('/', $url->route('plain', [], false)); @@ -117,14 +120,14 @@ public function testBasicRouteGeneration() public function testFluentRouteNameDefinitions() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); /* * Named Routes */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar', []); + $route = new Route(['GET'], 'foo/bar', []); $route->name('foo'); $routes->add($route); $routes->refreshNameLookups(); @@ -135,19 +138,19 @@ public function testFluentRouteNameDefinitions() public function testControllerRoutesWithADefaultNamespace() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); $url->setRootControllerNamespace('namespace'); /* * Controller Route Route */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar', ['controller' => 'namespace\foo@bar']); + $route = new Route(['GET'], 'foo/bar', ['controller' => 'namespace\foo@bar']); $routes->add($route); - $route = new Illuminate\Routing\Route(['GET'], 'something/else', ['controller' => 'something\foo@bar']); + $route = new Route(['GET'], 'something/else', ['controller' => 'something\foo@bar']); $routes->add($route); $this->assertEquals('http://www.foo.com/foo/bar', $url->action('foo@bar')); @@ -157,13 +160,13 @@ public function testControllerRoutesWithADefaultNamespace() public function testControllerRoutesOutsideOfDefaultNamespace() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); $url->setRootControllerNamespace('namespace'); - $route = new Illuminate\Routing\Route(['GET'], 'root/namespace', ['controller' => '\root\namespace@foo']); + $route = new Route(['GET'], 'root/namespace', ['controller' => '\root\namespace@foo']); $routes->add($route); $this->assertEquals('http://www.foo.com/root/namespace', $url->action('\root\namespace@foo')); @@ -172,11 +175,11 @@ public function testControllerRoutesOutsideOfDefaultNamespace() public function testRoutableInterfaceRouting() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); - $route = new Illuminate\Routing\Route(['GET'], 'foo/{bar}', ['as' => 'routable']); + $route = new Route(['GET'], 'foo/{bar}', ['as' => 'routable']); $routes->add($route); $model = new RoutableInterfaceStub; @@ -188,11 +191,11 @@ public function testRoutableInterfaceRouting() public function testRoutableInterfaceRoutingWithSingleParameter() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); - $route = new Illuminate\Routing\Route(['GET'], 'foo/{bar}', ['as' => 'routable']); + $route = new Route(['GET'], 'foo/{bar}', ['as' => 'routable']); $routes->add($route); $model = new RoutableInterfaceStub; @@ -204,14 +207,14 @@ public function testRoutableInterfaceRoutingWithSingleParameter() public function testRoutesMaintainRequestScheme() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('https://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('https://www.foo.com/') ); /* * Named Routes */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar', ['as' => 'foo']); + $route = new Route(['GET'], 'foo/bar', ['as' => 'foo']); $routes->add($route); $this->assertEquals('https://www.foo.com/foo/bar', $url->route('foo')); @@ -220,14 +223,14 @@ public function testRoutesMaintainRequestScheme() public function testHttpOnlyRoutes() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('https://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('https://www.foo.com/') ); /* * Named Routes */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar', ['as' => 'foo', 'http']); + $route = new Route(['GET'], 'foo/bar', ['as' => 'foo', 'http']); $routes->add($route); $this->assertEquals('http://www.foo.com/foo/bar', $url->route('foo')); @@ -236,17 +239,17 @@ public function testHttpOnlyRoutes() public function testRoutesWithDomains() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar', ['as' => 'foo', 'domain' => 'sub.foo.com']); + $route = new Route(['GET'], 'foo/bar', ['as' => 'foo', 'domain' => 'sub.foo.com']); $routes->add($route); /* * Wildcards & Domains... */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar/{baz}', ['as' => 'bar', 'domain' => 'sub.{foo}.com']); + $route = new Route(['GET'], 'foo/bar/{baz}', ['as' => 'bar', 'domain' => 'sub.{foo}.com']); $routes->add($route); $this->assertEquals('http://sub.foo.com/foo/bar', $url->route('foo')); @@ -257,17 +260,17 @@ public function testRoutesWithDomains() public function testRoutesWithDomainsAndPorts() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com:8080/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com:8080/') ); - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar', ['as' => 'foo', 'domain' => 'sub.foo.com']); + $route = new Route(['GET'], 'foo/bar', ['as' => 'foo', 'domain' => 'sub.foo.com']); $routes->add($route); /* * Wildcards & Domains... */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar/{baz}', ['as' => 'bar', 'domain' => 'sub.{foo}.com']); + $route = new Route(['GET'], 'foo/bar/{baz}', ['as' => 'bar', 'domain' => 'sub.{foo}.com']); $routes->add($route); $this->assertEquals('http://sub.foo.com:8080/foo/bar', $url->route('foo')); @@ -277,29 +280,29 @@ public function testRoutesWithDomainsAndPorts() public function testHttpsRoutesWithDomains() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('https://foo.com/') + $routes = new RouteCollection, + $request = Request::create('https://foo.com/') ); /* * When on HTTPS, no need to specify 443 */ - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar', ['as' => 'baz', 'domain' => 'sub.foo.com']); + $route = new Route(['GET'], 'foo/bar', ['as' => 'baz', 'domain' => 'sub.foo.com']); $routes->add($route); $this->assertEquals('https://sub.foo.com/foo/bar', $url->route('baz')); } public function testRoutesWithDomainsThroughProxy() { - Illuminate\Http\Request::setTrustedProxies(['10.0.0.1']); + Request::setTrustedProxies(['10.0.0.1']); $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/', 'GET', [], [], [], ['REMOTE_ADDR' => '10.0.0.1', 'HTTP_X_FORWARDED_PORT' => '80']) + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/', 'GET', [], [], [], ['REMOTE_ADDR' => '10.0.0.1', 'HTTP_X_FORWARDED_PORT' => '80']) ); - $route = new Illuminate\Routing\Route(['GET'], 'foo/bar', ['as' => 'foo', 'domain' => 'sub.foo.com']); + $route = new Route(['GET'], 'foo/bar', ['as' => 'foo', 'domain' => 'sub.foo.com']); $routes->add($route); $this->assertEquals('http://sub.foo.com/foo/bar', $url->route('foo')); @@ -308,11 +311,11 @@ public function testRoutesWithDomainsThroughProxy() public function testUrlGenerationForControllers() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com:8080/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com:8080/') ); - $route = new Illuminate\Routing\Route(['GET'], 'foo/{one}/{two?}/{three?}', ['as' => 'foo', function () {}]); + $route = new Route(['GET'], 'foo/{one}/{two?}/{three?}', ['as' => 'foo', function () {}]); $routes->add($route); $this->assertEquals('http://www.foo.com:8080/foo', $url->route('foo')); @@ -321,8 +324,8 @@ public function testUrlGenerationForControllers() public function testForceRootUrl() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); $url->forceRootUrl('https://www.bar.com'); @@ -336,12 +339,12 @@ public function testForceRootUrl() * Route Based... */ $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); $url->forceSchema('https'); - $route = new Illuminate\Routing\Route(['GET'], '/foo', ['as' => 'plain']); + $route = new Route(['GET'], '/foo', ['as' => 'plain']); $routes->add($route); $this->assertEquals('https://www.foo.com/foo', $url->route('plain')); @@ -353,8 +356,8 @@ public function testForceRootUrl() public function testPrevious() { $url = new UrlGenerator( - $routes = new Illuminate\Routing\RouteCollection, - $request = Illuminate\Http\Request::create('http://www.foo.com/') + $routes = new RouteCollection, + $request = Request::create('http://www.foo.com/') ); $url->getRequest()->headers->set('referer', 'http://www.bar.com/');
false
Other
laravel
framework
8c211754a6d6d00dbaa5f46e3ae70378c02e6025.json
Update method documentation Same as https://github.com/laravel/docs/pull/1922
src/Illuminate/Foundation/Testing/AssertionsTrait.php
@@ -131,7 +131,7 @@ public function assertRedirectedToAction($name, $parameters = [], $with = []) } /** - * Assert that the session has a given list of values. + * Assert that the session has a given value. * * @param string|array $key * @param mixed $value
false
Other
laravel
framework
98271e29dc7ef6ea808c2b5786204b93b20aa7bd.json
fix doc block
src/Illuminate/Foundation/Auth/ResetsPasswords.php
@@ -118,7 +118,7 @@ protected function resetPassword($user, $password) } /** - * Get the post register / login redirect path. + * Get the post password reset redirect path. * * @return string */
false
Other
laravel
framework
9ddc23401389dc5f316591114540f607176491c7.json
Fix return type
src/Illuminate/Console/Command.php
@@ -290,7 +290,7 @@ public function secret($question, $fallback = true) * @param string $default * @param mixed $attempts * @param bool $multiple - * @return bool + * @return string */ public function choice($question, array $choices, $default = null, $attempts = null, $multiple = null) {
false
Other
laravel
framework
4b853b668833941282dd133d1741aa479eb6840e.json
Update vlucas/phpdotenv to ~2.0
composer.json
@@ -38,7 +38,7 @@ "symfony/routing": "2.8.*|3.0.*", "symfony/translation": "2.8.*|3.0.*", "symfony/var-dumper": "2.8.*|3.0.*", - "vlucas/phpdotenv": "~1.0" + "vlucas/phpdotenv": "~2.0" }, "replace": { "illuminate/auth": "self.version",
true
Other
laravel
framework
4b853b668833941282dd133d1741aa479eb6840e.json
Update vlucas/phpdotenv to ~2.0
src/Illuminate/Foundation/Bootstrap/DetectEnvironment.php
@@ -2,7 +2,7 @@ namespace Illuminate\Foundation\Bootstrap; -use Dotenv; +use Dotenv\Dotenv; use InvalidArgumentException; use Illuminate\Contracts\Foundation\Application; @@ -17,7 +17,7 @@ class DetectEnvironment public function bootstrap(Application $app) { try { - Dotenv::load($app->environmentPath(), $app->environmentFile()); + (new Dotenv($app->environmentPath(), $app->environmentFile()))->load(); } catch (InvalidArgumentException $e) { // }
true
Other
laravel
framework
6b8f3f96a40ad22f6ac1436eca12f13d4caa0bef.json
change mysql schema grammar to remove default 0
src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
@@ -547,10 +547,6 @@ protected function typeTimestampTz(Fluent $column) return 'timestamp default CURRENT_TIMESTAMP'; } - if (! $column->nullable && $column->default === null) { - return 'timestamp default 0'; - } - return 'timestamp'; }
true
Other
laravel
framework
6b8f3f96a40ad22f6ac1436eca12f13d4caa0bef.json
change mysql schema grammar to remove default 0
tests/Database/DatabaseMySqlSchemaGrammarTest.php
@@ -575,7 +575,7 @@ public function testAddingTimeStampTz() $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertEquals(1, count($statements)); - $this->assertEquals('alter table `users` add `foo` timestamp default 0 not null', $statements[0]); + $this->assertEquals('alter table `users` add `foo` timestamp not null', $statements[0]); } public function testAddingTimeStampTzWithDefault() @@ -605,7 +605,7 @@ public function testAddingTimeStampsTz() $statements = $blueprint->toSql($this->getConnection(), $this->getGrammar()); $this->assertEquals(1, count($statements)); - $this->assertEquals('alter table `users` add `created_at` timestamp default 0 not null, add `updated_at` timestamp default 0 not null', $statements[0]); + $this->assertEquals('alter table `users` add `created_at` timestamp not null, add `updated_at` timestamp not null', $statements[0]); } public function testAddingRememberToken()
true
Other
laravel
framework
5ad598c6b445630895743844695b0a0ada732e66.json
Add flatMap method to Collection Another common array operation from functional languages, makes it quick to map out an array of arrays and collapse them into one. Reference: http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-flat_map http://elixir-lang.org/docs/v1.0/elixir/Enum.html#flat_map/2 http://alvinalexander.com/scala/collection-scala-flatmap-examples-map-fl atten
src/Illuminate/Support/Collection.php
@@ -468,6 +468,17 @@ public function map(callable $callback) return new static(array_combine($keys, $items)); } + /** + * Map a collection and flatten the result by a single level. + * + * @param callable $callback + * @return static + */ + public function flatMap(callable $callback) + { + return $this->map($callback)->collapse(); + } + /** * Get the max value of a given key. *
true
Other
laravel
framework
5ad598c6b445630895743844695b0a0ada732e66.json
Add flatMap method to Collection Another common array operation from functional languages, makes it quick to map out an array of arrays and collapse them into one. Reference: http://ruby-doc.org/core-2.2.3/Enumerable.html#method-i-flat_map http://elixir-lang.org/docs/v1.0/elixir/Enum.html#flat_map/2 http://alvinalexander.com/scala/collection-scala-flatmap-examples-map-fl atten
tests/Support/SupportCollectionTest.php
@@ -595,6 +595,16 @@ public function testMap() $this->assertEquals(['first' => 'first-rolyat', 'last' => 'last-llewto'], $data->all()); } + public function testFlatMap() + { + $data = new Collection([ + ['name' => 'taylor', 'hobbies' => ['programming', 'basketball']], + ['name' => 'adam', 'hobbies' => ['music', 'powerlifting']], + ]); + $data = $data->flatMap(function ($person) { return $person['hobbies']; }); + $this->assertEquals(['programming', 'basketball', 'music', 'powerlifting'], $data->all()); + } + public function testTransform() { $data = new Collection(['first' => 'taylor', 'last' => 'otwell']);
true
Other
laravel
framework
b40d7c6400bbc0b7c407e4675bdf58376002ddc7.json
Add CheckHttpCache middleware
src/Illuminate/Foundation/Http/Middleware/CheckHttpCache.php
@@ -0,0 +1,27 @@ +<?php + +namespace Illuminate\Foundation\Http\Middleware; + +use Closure; +use Symfony\Component\HttpFoundation\Response; + +class CheckHttpCache +{ + /** + * Handle an incoming request. + * + * @param \Illuminate\Http\Request $request + * @param \Closure $next + * @return mixed + */ + public function handle($request, Closure $next) + { + $response = $next($request); + + if ($response instanceof Response) { + $response->isNotModified($request); + } + + return $response; + } +}
false
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
composer.json
@@ -29,15 +29,15 @@ "paragonie/random_compat": "~1.1", "psy/psysh": "0.6.*", "swiftmailer/swiftmailer": "~5.1", - "symfony/console": "3.1.*", - "symfony/debug": "3.1.*", - "symfony/finder": "3.1.*", - "symfony/http-foundation": "3.1.*", - "symfony/http-kernel": "3.1.*", - "symfony/process": "3.1.*", - "symfony/routing": "3.1.*", - "symfony/translation": "3.1.*", - "symfony/var-dumper": "3.1.*", + "symfony/console": "3.0.*", + "symfony/debug": "3.0.*", + "symfony/finder": "3.0.*", + "symfony/http-foundation": "3.0.*", + "symfony/http-kernel": "3.0.*", + "symfony/process": "3.0.*", + "symfony/routing": "3.0.*", + "symfony/translation": "3.0.*", + "symfony/var-dumper": "3.0.*", "vlucas/phpdotenv": "~1.0" }, "replace": { @@ -78,8 +78,8 @@ "pda/pheanstalk": "~3.0", "phpunit/phpunit": "~4.0", "predis/predis": "~1.0", - "symfony/css-selector": "3.1.*", - "symfony/dom-crawler": "3.1.*" + "symfony/css-selector": "3.0.*", + "symfony/dom-crawler": "3.0.*" }, "autoload": { "classmap": [
true
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
src/Illuminate/Console/composer.json
@@ -17,7 +17,7 @@ "php": ">=5.5.9", "illuminate/contracts": "5.3.*", "illuminate/support": "5.3.*", - "symfony/console": "3.1.*", + "symfony/console": "3.0.*", "nesbot/carbon": "~1.20" }, "autoload": { @@ -33,7 +33,7 @@ "suggest": { "guzzlehttp/guzzle": "Required to use the thenPing method on schedules (~6.0).", "mtdowling/cron-expression": "Required to use scheduling component (~1.0).", - "symfony/process": "Required to use scheduling component (3.1.*)." + "symfony/process": "Required to use scheduling component (3.0.*)." }, "minimum-stability": "dev" }
true
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
src/Illuminate/Cookie/composer.json
@@ -17,8 +17,8 @@ "php": ">=5.5.9", "illuminate/contracts": "5.3.*", "illuminate/support": "5.3.*", - "symfony/http-kernel": "3.1.*", - "symfony/http-foundation": "3.1.*" + "symfony/http-kernel": "3.0.*", + "symfony/http-foundation": "3.0.*" }, "autoload": { "psr-4": {
true
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
src/Illuminate/Filesystem/composer.json
@@ -17,7 +17,7 @@ "php": ">=5.5.9", "illuminate/contracts": "5.3.*", "illuminate/support": "5.3.*", - "symfony/finder": "3.1.*" + "symfony/finder": "3.0.*" }, "autoload": { "psr-4": {
true
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
src/Illuminate/Http/composer.json
@@ -17,8 +17,8 @@ "php": ">=5.5.9", "illuminate/session": "5.3.*", "illuminate/support": "5.3.*", - "symfony/http-foundation": "3.1.*", - "symfony/http-kernel": "3.1.*" + "symfony/http-foundation": "3.0.*", + "symfony/http-kernel": "3.0.*" }, "autoload": { "psr-4": {
true
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
src/Illuminate/Queue/composer.json
@@ -20,7 +20,7 @@ "illuminate/container": "5.3.*", "illuminate/http": "5.3.*", "illuminate/support": "5.3.*", - "symfony/process": "3.1.*", + "symfony/process": "3.0.*", "nesbot/carbon": "~1.20" }, "autoload": {
true
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
src/Illuminate/Routing/composer.json
@@ -21,9 +21,9 @@ "illuminate/pipeline": "5.3.*", "illuminate/session": "5.3.*", "illuminate/support": "5.3.*", - "symfony/http-foundation": "3.1.*", - "symfony/http-kernel": "3.1.*", - "symfony/routing": "3.1.*" + "symfony/http-foundation": "3.0.*", + "symfony/http-kernel": "3.0.*", + "symfony/routing": "3.0.*" }, "autoload": { "psr-4": {
true
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
src/Illuminate/Session/composer.json
@@ -18,8 +18,8 @@ "illuminate/contracts": "5.3.*", "illuminate/support": "5.3.*", "nesbot/carbon": "~1.20", - "symfony/finder": "3.1.*", - "symfony/http-foundation": "3.1.*" + "symfony/finder": "3.0.*", + "symfony/http-foundation": "3.0.*" }, "autoload": { "psr-4": {
true
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
src/Illuminate/Support/composer.json
@@ -37,8 +37,8 @@ "illuminate/filesystem": "Required to use the composer class (5.2.*).", "jeremeamia/superclosure": "Required to be able to serialize closures (~2.0).", "paragonie/random_compat": "Provides a compatible interface like PHP7's random_bytes() in PHP 5 projects (~1.1).", - "symfony/process": "Required to use the composer class (3.1.*).", - "symfony/var-dumper": "Required to use the dd function (3.1.*)." + "symfony/process": "Required to use the composer class (3.0.*).", + "symfony/var-dumper": "Required to use the dd function (3.0.*)." }, "minimum-stability": "dev" }
true
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
src/Illuminate/Translation/composer.json
@@ -17,7 +17,7 @@ "php": ">=5.5.9", "illuminate/filesystem": "5.3.*", "illuminate/support": "5.3.*", - "symfony/translation": "3.1.*" + "symfony/translation": "3.0.*" }, "autoload": { "psr-4": {
true
Other
laravel
framework
ec673e00d77820b4824f04beb5f106c8e19b8bd9.json
Use symfony 3.0 rather than 3.1 for now
src/Illuminate/Validation/composer.json
@@ -18,8 +18,8 @@ "illuminate/container": "5.3.*", "illuminate/contracts": "5.3.*", "illuminate/support": "5.3.*", - "symfony/http-foundation": "3.1.*", - "symfony/translation": "3.1.*" + "symfony/http-foundation": "3.0.*", + "symfony/translation": "3.0.*" }, "autoload": { "psr-4": {
true
Other
laravel
framework
4fd6db18d1586eeb8f12424394f143e465015bbc.json
Allow column aliases in query builder pluck
src/Illuminate/Database/Query/Builder.php
@@ -1562,14 +1562,14 @@ public function lists($column, $key = null) } /** - * Strip off the table name from a column identifier. + * Strip off the table name or alias from a column identifier. * * @param string $column * @return string */ protected function stripTable($column) { - return is_null($column) ? $column : last(explode('.', $column)); + return is_null($column) ? $column : last(preg_split('~\.| ~', $column)); } /**
true
Other
laravel
framework
4fd6db18d1586eeb8f12424394f143e465015bbc.json
Allow column aliases in query builder pluck
tests/Database/DatabaseEloquentIntegrationTest.php
@@ -41,6 +41,7 @@ public function setUp() { $this->schema()->create('users', function ($table) { $table->increments('id'); + $table->string('name')->nullable(); $table->string('email')->unique(); $table->string('role')->default('standard'); $table->timestamps(); @@ -181,16 +182,17 @@ public function testPluck() public function testPluckWithJoin() { - $user1 = EloquentTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']); - $user2 = EloquentTestUser::create(['id' => 2, 'email' => 'abigailotwell@gmail.com']); + $user1 = EloquentTestUser::create(['id' => 1, 'name' => 'Taylor', 'email' => 'taylorotwell@gmail.com']); + $user2 = EloquentTestUser::create(['id' => 2, 'name' => 'Abigail', 'email' => 'abigailotwell@gmail.com']); $user2->posts()->create(['id' => 1, 'name' => 'First post']); $user1->posts()->create(['id' => 2, 'name' => 'Second post']); $query = EloquentTestUser::join('posts', 'users.id', '=', 'posts.user_id'); - $this->assertEquals([1 => 'First post', 2 => 'Second post'], $query->pluck('name', 'posts.id')->all()); - $this->assertEquals([2 => 'First post', 1 => 'Second post'], $query->pluck('name', 'users.id')->all()); + $this->assertEquals([1 => 'First post', 2 => 'Second post'], $query->pluck('posts.name', 'posts.id')->all()); + $this->assertEquals([2 => 'First post', 1 => 'Second post'], $query->pluck('posts.name', 'users.id')->all()); + $this->assertEquals(['Abigail' => 'First post', 'Taylor' => 'Second post'], $query->pluck('posts.name', 'users.name as user_name')->all()); } public function testFindOrFail()
true
Other
laravel
framework
c6b1dcc9664b786fcaca9baab9631801eae4ae08.json
remove pointless class
src/Illuminate/Foundation/Composer.php
@@ -1,13 +0,0 @@ -<?php - -namespace Illuminate\Foundation; - -use Illuminate\Support\Composer as NewComposer; - -/** - * @deprecated since version 5.2. Use Illuminate\Support\Composer. - */ -class Composer extends NewComposer -{ - // -}
false
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
composer.json
@@ -75,7 +75,7 @@ }, "require-dev": { "aws/aws-sdk-php": "~3.0", - "iron-io/iron_mq": "~2.0", + "iron-io/iron_mq": "~2.0|~4.0", "mockery/mockery": "~0.9.2", "pda/pheanstalk": "~3.0", "phpunit/phpunit": "~4.0", @@ -103,7 +103,7 @@ "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~6.0).", - "iron-io/iron_mq": "Required to use the iron queue driver (~2.0).", + "iron-io/iron_mq": "Required to use the iron queue driver (~4.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).",
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Database/Console/Migrations/StatusCommand.php
@@ -3,6 +3,7 @@ namespace Illuminate\Database\Console\Migrations; use Illuminate\Database\Migrations\Migrator; +use Symfony\Component\Console\Input\InputOption; class StatusCommand extends BaseCommand { @@ -51,11 +52,19 @@ public function fire() return $this->error('No migrations found.'); } + $this->migrator->setConnection($this->input->getOption('database')); + + if (! is_null($path = $this->input->getOption('path'))) { + $path = $this->laravel->basePath().'/'.$path; + } else { + $path = $this->getMigrationPath(); + } + $ran = $this->migrator->getRepository()->getRan(); $migrations = []; - foreach ($this->getAllMigrationFiles() as $migration) { + foreach ($this->getAllMigrationFiles($path) as $migration) { $migrations[] = in_array($migration, $ran) ? ['<info>Y</info>', $migration] : ['<fg=red>N</fg=red>', $migration]; } @@ -69,10 +78,25 @@ public function fire() /** * Get all of the migration files. * + * @param string $path + * @return array + */ + protected function getAllMigrationFiles($path) + { + return $this->migrator->getMigrationFiles($path); + } + + /** + * Get the console command options. + * * @return array */ - protected function getAllMigrationFiles() + protected function getOptions() { - return $this->migrator->getMigrationFiles($this->getMigrationPath()); + return [ + ['database', null, InputOption::VALUE_OPTIONAL, 'The database connection to use.'], + + ['path', null, InputOption::VALUE_OPTIONAL, 'The path of migrations files to use.'], + ]; } }
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Database/DatabaseServiceProvider.php
@@ -50,6 +50,10 @@ public function register() $this->app->singleton('db', function ($app) { return new DatabaseManager($app, $app['db.factory']); }); + + $this->app->bind('db.connection', function ($app) { + return $app['db']->connection(); + }); } /**
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Database/Eloquent/Relations/MorphTo.php
@@ -104,6 +104,10 @@ protected function buildDictionary(Collection $models) */ public function match(array $models, Collection $results, $relation) { + foreach (array_keys($this->dictionary) as $type) { + $this->matchToMorphParents($type, $this->getResultsByType($type), $relation); + } + return $models; } @@ -136,35 +140,19 @@ public function dissociate() return $this->parent->setRelation($this->relation, null); } - /** - * Get the results of the relationship. - * - * Called via eager load method of Eloquent query builder. - * - * @return mixed - */ - public function getEager() - { - foreach (array_keys($this->dictionary) as $type) { - $this->matchToMorphParents($type, $this->getResultsByType($type)); - } - - return $this->models; - } - /** * Match the results for a given type to their parents. * - * @param string $type - * @param \Illuminate\Database\Eloquent\Collection $results - * @return void + * @param string $type + * @param \Illuminate\Database\Eloquent\Collection $results + * @param string $relation */ - protected function matchToMorphParents($type, Collection $results) + protected function matchToMorphParents($type, Collection $results, $relation) { foreach ($results as $result) { if (isset($this->dictionary[$type][$result->getKey()])) { foreach ($this->dictionary[$type][$result->getKey()] as $model) { - $model->setRelation($this->relation, $result); + $model->setRelation($relation, $result); } } }
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Foundation/Application.php
@@ -1037,6 +1037,7 @@ public function registerCoreContainerAliases() 'cookie' => ['Illuminate\Cookie\CookieJar', 'Illuminate\Contracts\Cookie\Factory', 'Illuminate\Contracts\Cookie\QueueingFactory'], 'encrypter' => ['Illuminate\Encryption\Encrypter', 'Illuminate\Contracts\Encryption\Encrypter'], 'db' => 'Illuminate\Database\DatabaseManager', + 'db.connection' => ['Illuminate\Database\Connection', 'Illuminate\Database\ConnectionInterface'], 'events' => ['Illuminate\Events\Dispatcher', 'Illuminate\Contracts\Events\Dispatcher'], 'files' => 'Illuminate\Filesystem\Filesystem', 'filesystem' => ['Illuminate\Filesystem\FilesystemManager', 'Illuminate\Contracts\Filesystem\Factory'],
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Foundation/Bootstrap/ConfigureLogging.php
@@ -28,13 +28,6 @@ public function bootstrap(Application $app) } else { $this->configureHandlers($app, $log); } - - // Next, we will bind a Closure that resolves the PSR logger implementation - // as this will grant us the ability to be interoperable with many other - // libraries which are able to utilize the PSR standardized interface. - $app->bind('Psr\Log\LoggerInterface', function ($app) { - return $app['log']->getMonolog(); - }); } /**
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php
@@ -76,7 +76,11 @@ public function handle($request, Closure $next) protected function shouldPassThrough($request) { foreach ($this->except as $except) { - if ($request->is(trim($except, '/'))) { + if ($except !== '/') { + $except = trim($except, '/'); + } + + if ($request->is($except)) { return true; } }
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Http/Request.php
@@ -595,7 +595,7 @@ public static function matchesType($actual, $type) */ public function isJson() { - return Str::contains($this->header('CONTENT_TYPE'), '/json'); + return Str::contains($this->header('CONTENT_TYPE'), ['/json', '+json']); } /**
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Queue/IronQueue.php
@@ -134,11 +134,12 @@ public function pop($queue = null) * * @param string $queue * @param string $id + * @param string $reservationId * @return void */ - public function deleteMessage($queue, $id) + public function deleteMessage($queue, $id, $reservationId) { - $this->iron->deleteMessage($queue, $id); + $this->iron->deleteMessage($queue, $id, $reservationId); } /**
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Queue/Jobs/IronJob.php
@@ -83,7 +83,9 @@ public function delete() return; } - $this->iron->deleteMessage($this->getQueue(), $this->job->id); + $this->iron->deleteMessage( + $this->getQueue(), $this->job->id, $this->job->reservation_id + ); } /**
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Queue/composer.json
@@ -39,7 +39,7 @@ "suggest": { "aws/aws-sdk-php": "Required to use the SQS queue driver (~3.0).", "illuminate/redis": "Required to use the redis queue driver (5.2.*).", - "iron-io/iron_mq": "Required to use the iron queue driver (~2.0).", + "iron-io/iron_mq": "Required to use the iron queue driver (~4.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0)." }, "minimum-stability": "dev"
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
src/Illuminate/Routing/UrlGenerator.php
@@ -168,7 +168,14 @@ public function to($path, $extra = [], $secure = null) // for passing the array of parameters to this URL as a list of segments. $root = $this->getRootUrl($scheme); - return $this->trimUrl($root, $path, $tail); + if (($queryPosition = strpos($path, '?')) !== false) { + $query = mb_substr($path, $queryPosition); + $path = mb_substr($path, 0, $queryPosition); + } else { + $query = ''; + } + + return $this->trimUrl($root, $path, $tail).$query; } /**
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
tests/Database/DatabaseEloquentMorphToTest.php
@@ -77,7 +77,7 @@ public function testModelsAreProperlyPulledAndMatched() $two->shouldReceive('setRelation')->once()->with('relation', $resultOne); $three->shouldReceive('setRelation')->once()->with('relation', $resultTwo); - $relation->getEager(); + $relation->match([$one, $two, $three], Collection::make([$resultOne, $resultTwo]), 'relation'); } public function testModelsWithSoftDeleteAreProperlyPulled()
true
Other
laravel
framework
4858b91f8482c8d72e13aa51146b3431ef716d37.json
require 4.0 of iron
tests/Routing/RoutingUrlGeneratorTest.php
@@ -15,6 +15,7 @@ public function testBasicGeneration() $this->assertEquals('http://www.foo.com/foo/bar', $url->to('foo/bar')); $this->assertEquals('https://www.foo.com/foo/bar', $url->to('foo/bar', [], true)); $this->assertEquals('https://www.foo.com/foo/bar/baz/boom', $url->to('foo/bar', ['baz', 'boom'], true)); + $this->assertEquals('https://www.foo.com/foo/bar/baz?foo=bar', $url->to('foo/bar?foo=bar', ['baz'], true)); /* * Test HTTPS request URL generation...
true
Other
laravel
framework
53131ddf5285a675c8b5560d19d2faaf91882811.json
allow 4.0 of iron driver.
composer.json
@@ -75,7 +75,7 @@ }, "require-dev": { "aws/aws-sdk-php": "~3.0", - "iron-io/iron_mq": "~2.0", + "iron-io/iron_mq": "~2.0|~4.0", "mockery/mockery": "~0.9.2", "pda/pheanstalk": "~3.0", "phpunit/phpunit": "~4.0", @@ -103,7 +103,7 @@ "doctrine/dbal": "Required to rename columns and drop SQLite columns (~2.4).", "fzaninotto/faker": "Required to use the eloquent factory builder (~1.4).", "guzzlehttp/guzzle": "Required to use the Mailgun and Mandrill mail drivers (~5.3|~6.0).", - "iron-io/iron_mq": "Required to use the iron queue driver (~2.0).", + "iron-io/iron_mq": "Required to use the iron queue driver (~2.0|~4.0).", "league/flysystem-aws-s3-v3": "Required to use the Flysystem S3 driver (~1.0).", "league/flysystem-rackspace": "Required to use the Flysystem Rackspace driver (~1.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0).",
true
Other
laravel
framework
53131ddf5285a675c8b5560d19d2faaf91882811.json
allow 4.0 of iron driver.
src/Illuminate/Queue/IronQueue.php
@@ -145,11 +145,17 @@ public function pop($queue = null) * * @param string $queue * @param string $id + * @param string|null $reservation * @return void */ - public function deleteMessage($queue, $id) + public function deleteMessage($queue, $id, $reservation = null) { - $this->iron->deleteMessage($queue, $id); + if ($reservation) { + $this->iron->deleteMessage($queue, $id, $reservation); + } else { + // Version 1 of API does not use reservation_id + $this->iron->deleteMessage($queue, $id); + } } /**
true
Other
laravel
framework
53131ddf5285a675c8b5560d19d2faaf91882811.json
allow 4.0 of iron driver.
src/Illuminate/Queue/Jobs/IronJob.php
@@ -83,7 +83,11 @@ public function delete() return; } - $this->iron->deleteMessage($this->getQueue(), $this->job->id); + if (property_exists($this->job, 'reservation_id')) { + $this->iron->deleteMessage($this->getQueue(), $this->job->id, $this->job->reservation_id); + } else { + $this->iron->deleteMessage($this->getQueue(), $this->job->id); + } } /**
true
Other
laravel
framework
53131ddf5285a675c8b5560d19d2faaf91882811.json
allow 4.0 of iron driver.
src/Illuminate/Queue/composer.json
@@ -39,7 +39,7 @@ "suggest": { "aws/aws-sdk-php": "Required to use the SQS queue driver (~3.0).", "illuminate/redis": "Required to use the redis queue driver (5.1.*).", - "iron-io/iron_mq": "Required to use the iron queue driver (~2.0).", + "iron-io/iron_mq": "Required to use the iron queue driver (~2.0|~4.0).", "pda/pheanstalk": "Required to use the beanstalk queue driver (~3.0)." }, "minimum-stability": "dev"
true
Other
laravel
framework
9dcf2c7e350aa23a6e833e13cbbdd714116b7e52.json
Drop unnecessary conditional in receiveJson() Both routes eventually end up at seeJson(); and since the first parameter's default is `null`, this conditional doesn't actually do anything. The one caveat is that a `null` `$data` would not `return` like one with real content, but I don't that was intentional or consequential.
src/Illuminate/Foundation/Testing/Concerns/MakesHttpRequests.php
@@ -189,11 +189,7 @@ protected function shouldReturnJson(array $data = null) */ protected function receiveJson($data = null) { - $this->seeJson(); - - if (! is_null($data)) { - return $this->seeJson($data); - } + return $this->seeJson($data); } /**
false
Other
laravel
framework
cccdad418159a856c72bec61c3ad16d754d5f35e.json
use json for mysql json now that 5.7 is out
src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
@@ -451,7 +451,7 @@ protected function typeEnum(Fluent $column) */ protected function typeJson(Fluent $column) { - return 'text'; + return 'json'; } /** @@ -462,7 +462,7 @@ protected function typeJson(Fluent $column) */ protected function typeJsonb(Fluent $column) { - return 'text'; + return 'json'; } /**
false
Other
laravel
framework
8c73439ee4b7be4ed63325a56f1551022b340867.json
Remove controller inspection from routing
src/Illuminate/Routing/ControllerInspector.php
@@ -1,136 +0,0 @@ -<?php - -namespace Illuminate\Routing; - -use ReflectionClass; -use ReflectionMethod; -use Illuminate\Support\Str; - -/** - * @deprecated since version 5.1. - */ -class ControllerInspector -{ - /** - * An array of HTTP verbs. - * - * @var array - */ - protected $verbs = [ - 'any', 'get', 'post', 'put', 'patch', - 'delete', 'head', 'options', - ]; - - /** - * Get the routable methods for a controller. - * - * @param string $controller - * @param string $prefix - * @return array - */ - public function getRoutable($controller, $prefix) - { - $routable = []; - - $reflection = new ReflectionClass($controller); - - $methods = $reflection->getMethods(ReflectionMethod::IS_PUBLIC); - - // To get the routable methods, we will simply spin through all methods on the - // controller instance checking to see if it belongs to the given class and - // is a publicly routable method. If so, we will add it to this listings. - foreach ($methods as $method) { - if ($this->isRoutable($method)) { - $data = $this->getMethodData($method, $prefix); - - $routable[$method->name][] = $data; - - // If the routable method is an index method, we will create a special index - // route which is simply the prefix and the verb and does not contain any - // the wildcard place-holders that each "typical" routes would contain. - if ($data['plain'] == $prefix.'/index') { - $routable[$method->name][] = $this->getIndexData($data, $prefix); - } - } - } - - return $routable; - } - - /** - * Determine if the given controller method is routable. - * - * @param \ReflectionMethod $method - * @return bool - */ - public function isRoutable(ReflectionMethod $method) - { - if ($method->class == 'Illuminate\Routing\Controller') { - return false; - } - - return Str::startsWith($method->name, $this->verbs); - } - - /** - * Get the method data for a given method. - * - * @param \ReflectionMethod $method - * @param string $prefix - * @return array - */ - public function getMethodData(ReflectionMethod $method, $prefix) - { - $verb = $this->getVerb($name = $method->name); - - $uri = $this->addUriWildcards($plain = $this->getPlainUri($name, $prefix)); - - return compact('verb', 'plain', 'uri'); - } - - /** - * Get the routable data for an index method. - * - * @param array $data - * @param string $prefix - * @return array - */ - protected function getIndexData($data, $prefix) - { - return ['verb' => $data['verb'], 'plain' => $prefix, 'uri' => $prefix]; - } - - /** - * Extract the verb from a controller action. - * - * @param string $name - * @return string - */ - public function getVerb($name) - { - return head(explode('_', Str::snake($name))); - } - - /** - * Determine the URI from the given method name. - * - * @param string $name - * @param string $prefix - * @return string - */ - public function getPlainUri($name, $prefix) - { - return $prefix.'/'.implode('-', array_slice(explode('_', Str::snake($name)), 1)); - } - - /** - * Add wildcards to the given URI. - * - * @param string $uri - * @return string - */ - public function addUriWildcards($uri) - { - return $uri.'/{one?}/{two?}/{three?}/{four?}/{five?}'; - } -}
true
Other
laravel
framework
8c73439ee4b7be4ed63325a56f1551022b340867.json
Remove controller inspection from routing
src/Illuminate/Routing/Router.php
@@ -3,7 +3,6 @@ namespace Illuminate\Routing; use Closure; -use Illuminate\Support\Arr; use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Http\Response; @@ -206,96 +205,6 @@ public function match($methods, $uri, $action) return $this->addRoute(array_map('strtoupper', (array) $methods), $uri, $action); } - /** - * Register an array of controllers with wildcard routing. - * - * @param array $controllers - * @return void - * - * @deprecated since version 5.1. - */ - public function controllers(array $controllers) - { - foreach ($controllers as $uri => $controller) { - $this->controller($uri, $controller); - } - } - - /** - * Route a controller to a URI with wildcard routing. - * - * @param string $uri - * @param string $controller - * @param array $names - * @return void - * - * @deprecated since version 5.1. - */ - public function controller($uri, $controller, $names = []) - { - $prepended = $controller; - - // First, we will check to see if a controller prefix has been registered in - // the route group. If it has, we will need to prefix it before trying to - // reflect into the class instance and pull out the method for routing. - if (! empty($this->groupStack)) { - $prepended = $this->prependGroupUses($controller); - } - - $routable = (new ControllerInspector) - ->getRoutable($prepended, $uri); - - // When a controller is routed using this method, we use Reflection to parse - // out all of the routable methods for the controller, then register each - // route explicitly for the developers, so reverse routing is possible. - foreach ($routable as $method => $routes) { - foreach ($routes as $route) { - $this->registerInspected($route, $controller, $method, $names); - } - } - - $this->addFallthroughRoute($controller, $uri); - } - - /** - * Register an inspected controller route. - * - * @param array $route - * @param string $controller - * @param string $method - * @param array $names - * @return void - * - * @deprecated since version 5.1. - */ - protected function registerInspected($route, $controller, $method, &$names) - { - $action = ['uses' => $controller.'@'.$method]; - - // If a given controller method has been named, we will assign the name to the - // controller action array, which provides for a short-cut to method naming - // so you don't have to define an individual route for these controllers. - $action['as'] = Arr::get($names, $method); - - $this->{$route['verb']}($route['uri'], $action); - } - - /** - * Add a fallthrough route for a controller. - * - * @param string $controller - * @param string $uri - * @return void - * - * @deprecated since version 5.1. - */ - protected function addFallthroughRoute($controller, $uri) - { - $missing = $this->any($uri.'/{_missing}', $controller.'@missingMethod'); - - $missing->where('_missing', '(.*)'); - } - /** * Register an array of resource controllers. *
true
Other
laravel
framework
8c73439ee4b7be4ed63325a56f1551022b340867.json
Remove controller inspection from routing
tests/Routing/RoutingRouteTest.php
@@ -711,13 +711,6 @@ public function testControllerRouting() $this->assertFalse(isset($_SERVER['route.test.controller.except.middleware'])); } - public function testControllerInspection() - { - $router = $this->getRouter(); - $router->controller('home', 'RouteTestInspectedControllerStub'); - $this->assertEquals('hello', $router->dispatch(Request::create('home/foo', 'GET'))->getContent()); - } - protected function getRouter() { return new Router(new Illuminate\Events\Dispatcher); @@ -772,14 +765,6 @@ public function handle($request, $next, $parameter1, $parameter2) } } -class RouteTestInspectedControllerStub extends Illuminate\Routing\Controller -{ - public function getFoo() - { - return 'hello'; - } -} - class RouteTestControllerExceptMiddleware { public function handle($request, $next)
true
Other
laravel
framework
98d01781bf76de817bf15b7f2fed5ba87e0e6f15.json
Drop support for class preloader 2.x
composer.json
@@ -18,7 +18,7 @@ "php": ">=5.5.9", "ext-mbstring": "*", "ext-openssl": "*", - "classpreloader/classpreloader": "~2.0|~3.0", + "classpreloader/classpreloader": "~3.0", "danielstjules/stringy": "~2.1", "doctrine/inflector": "~1.0", "jeremeamia/superclosure": "~2.0",
true
Other
laravel
framework
98d01781bf76de817bf15b7f2fed5ba87e0e6f15.json
Drop support for class preloader 2.x
src/Illuminate/Foundation/Console/OptimizeCommand.php
@@ -2,18 +2,10 @@ namespace Illuminate\Foundation\Console; -use PhpParser\Lexer; -use PhpParser\Parser; use ClassPreloader\Factory; use Illuminate\Console\Command; -use ClassPreloader\ClassPreloader; use Illuminate\Foundation\Composer; -use ClassPreloader\Parser\DirVisitor; -use ClassPreloader\Parser\FileVisitor; -use ClassPreloader\Parser\NodeTraverser; -use ClassPreloader\Exceptions\SkipFileException; use Symfony\Component\Console\Input\InputOption; -use PhpParser\PrettyPrinter\Standard as PrettyPrinter; use ClassPreloader\Exceptions\VisitorExceptionInterface; class OptimizeCommand extends Command @@ -82,42 +74,21 @@ public function fire() */ protected function compileClasses() { - $preloader = $this->getClassPreloader(); + $preloader = (new Factory)->create(['skip' => true]); $handle = $preloader->prepareOutput($this->laravel->getCachedCompilePath()); foreach ($this->getClassFiles() as $file) { try { fwrite($handle, $preloader->getCode($file, false)."\n"); - } catch (SkipFileException $ex) { - // Class Preloader 2.x } catch (VisitorExceptionInterface $e) { - // Class Preloader 3.x + // } } fclose($handle); } - /** - * Get the class preloader used by the command. - * - * @return \ClassPreloader\ClassPreloader - */ - protected function getClassPreloader() - { - // Class Preloader 3.x - if (class_exists(Factory::class)) { - return (new Factory)->create(['skip' => true]); - } - - $traverser = new NodeTraverser; - $traverser->addVisitor(new DirVisitor(true)); - $traverser->addVisitor(new FileVisitor(true)); - - return new ClassPreloader(new PrettyPrinter, new Parser(new Lexer), $traverser); - } - /** * Get the classes that should be combined and compiled. *
true
Other
laravel
framework
9bc717d955da4943c43cbb042a707e75ebb9265f.json
Implement JsonSerializable in paginators
src/Illuminate/Pagination/LengthAwarePaginator.php
@@ -4,14 +4,15 @@ use Countable; use ArrayAccess; +use JsonSerializable; use IteratorAggregate; use Illuminate\Support\Collection; use Illuminate\Contracts\Support\Jsonable; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Pagination\Presenter; use Illuminate\Contracts\Pagination\LengthAwarePaginator as LengthAwarePaginatorContract; -class LengthAwarePaginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, LengthAwarePaginatorContract +class LengthAwarePaginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, JsonSerializable, Jsonable, LengthAwarePaginatorContract { /** * The total number of items before slicing. @@ -151,6 +152,16 @@ public function toArray() ]; } + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + /** * Convert the object to its JSON representation. * @@ -159,6 +170,6 @@ public function toArray() */ public function toJson($options = 0) { - return json_encode($this->toArray(), $options); + return json_encode($this->jsonSerialize(), $options); } }
true
Other
laravel
framework
9bc717d955da4943c43cbb042a707e75ebb9265f.json
Implement JsonSerializable in paginators
src/Illuminate/Pagination/Paginator.php
@@ -4,14 +4,15 @@ use Countable; use ArrayAccess; +use JsonSerializable; use IteratorAggregate; use Illuminate\Support\Collection; use Illuminate\Contracts\Support\Jsonable; use Illuminate\Contracts\Support\Arrayable; use Illuminate\Contracts\Pagination\Presenter; use Illuminate\Contracts\Pagination\Paginator as PaginatorContract; -class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, Jsonable, PaginatorContract +class Paginator extends AbstractPaginator implements Arrayable, ArrayAccess, Countable, IteratorAggregate, JsonSerializable, Jsonable, PaginatorContract { /** * Determine if there are more items in the data source. @@ -122,6 +123,16 @@ public function toArray() ]; } + /** + * Convert the object into something JSON serializable. + * + * @return array + */ + public function jsonSerialize() + { + return $this->toArray(); + } + /** * Convert the object to its JSON representation. * @@ -130,6 +141,6 @@ public function toArray() */ public function toJson($options = 0) { - return json_encode($this->toArray(), $options); + return json_encode($this->jsonSerialize(), $options); } }
true
Other
laravel
framework
9b06643e404d11b3e14ab9711aeef1f5f72785dd.json
Use paginators as Htmlable
src/Illuminate/Pagination/AbstractPaginator.php
@@ -4,8 +4,9 @@ use Closure; use ArrayIterator; +use Illuminate\Contracts\Support\Htmlable; -abstract class AbstractPaginator +abstract class AbstractPaginator implements Htmlable { /** * All of the items being paginated. @@ -482,6 +483,16 @@ public function __call($method, $parameters) */ public function __toString() { - return $this->render(); + return (string) $this->render(); + } + + /** + * Render the contents of the paginator to HTML. + * + * @return string + */ + public function toHtml() + { + return (string) $this->render(); } }
false
Other
laravel
framework
9cb46e6d6c4576aad6fcbc2e63a2837b2e2a4e95.json
Add database connection to DI container
src/Illuminate/Database/DatabaseServiceProvider.php
@@ -50,6 +50,10 @@ public function register() $this->app->singleton('db', function ($app) { return new DatabaseManager($app, $app['db.factory']); }); + + $this->app->bind('db.connection', function ($app) { + return $app['db']->connection(); + }); } /**
true
Other
laravel
framework
9cb46e6d6c4576aad6fcbc2e63a2837b2e2a4e95.json
Add database connection to DI container
src/Illuminate/Foundation/Application.php
@@ -1037,6 +1037,7 @@ public function registerCoreContainerAliases() 'cookie' => ['Illuminate\Cookie\CookieJar', 'Illuminate\Contracts\Cookie\Factory', 'Illuminate\Contracts\Cookie\QueueingFactory'], 'encrypter' => ['Illuminate\Encryption\Encrypter', 'Illuminate\Contracts\Encryption\Encrypter'], 'db' => 'Illuminate\Database\DatabaseManager', + 'db.connection' => ['Illuminate\Database\Connection', 'Illuminate\Database\ConnectionInterface'], 'events' => ['Illuminate\Events\Dispatcher', 'Illuminate\Contracts\Events\Dispatcher'], 'files' => 'Illuminate\Filesystem\Filesystem', 'filesystem' => ['Illuminate\Filesystem\FilesystemManager', 'Illuminate\Contracts\Filesystem\Factory'],
true
Other
laravel
framework
1fdc127aeda134b175e115142cdccd4d9d6611a4.json
Fix query strings handling
src/Illuminate/Routing/UrlGenerator.php
@@ -167,7 +167,14 @@ public function to($path, $extra = [], $secure = null) // for passing the array of parameters to this URL as a list of segments. $root = $this->getRootUrl($scheme); - return $this->trimUrl($root, $path, $tail); + if (($queryStart = strpos($path, '?')) !== false) { + $query = mb_substr($path, $queryStart); + $path = mb_substr($path, 0, $queryStart); + } else { + $query = null; + } + + return $this->trimUrl($root, $path, $tail).$query; } /**
true
Other
laravel
framework
1fdc127aeda134b175e115142cdccd4d9d6611a4.json
Fix query strings handling
tests/Routing/RoutingUrlGeneratorTest.php
@@ -15,6 +15,7 @@ public function testBasicGeneration() $this->assertEquals('http://www.foo.com/foo/bar', $url->to('foo/bar')); $this->assertEquals('https://www.foo.com/foo/bar', $url->to('foo/bar', [], true)); $this->assertEquals('https://www.foo.com/foo/bar/baz/boom', $url->to('foo/bar', ['baz', 'boom'], true)); + $this->assertEquals('https://www.foo.com/foo/bar/baz?foo=bar', $url->to('foo/bar?foo=bar', ['baz'], true)); /* * Test HTTPS request URL generation...
true
Other
laravel
framework
a0b5cd6d6af1ed5f599a81d4005168e134b150a7.json
Add tests for only/except multiple arguments
tests/Support/SupportCollectionTest.php
@@ -417,7 +417,10 @@ public function testExcept() $data = new Collection(['first' => 'Taylor', 'last' => 'Otwell', 'email' => 'taylorotwell@gmail.com']); $this->assertEquals(['first' => 'Taylor'], $data->except(['last', 'email', 'missing'])->all()); + $this->assertEquals(['first' => 'Taylor'], $data->except('last', 'email', 'missing')->all()); + $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except(['last'])->all()); + $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except('last')->all()); } public function testPluckWithArrayAndObjectValues() @@ -847,7 +850,10 @@ public function testOnly() $data = new Collection(['first' => 'Taylor', 'last' => 'Otwell', 'email' => 'taylorotwell@gmail.com']); $this->assertEquals(['first' => 'Taylor'], $data->only(['first', 'missing'])->all()); + $this->assertEquals(['first' => 'Taylor'], $data->only('first', 'missing')->all()); + $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->only(['first', 'email'])->all()); + $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->only('first', 'email')->all()); } public function testGettingAvgItemsFromCollection()
false
Other
laravel
framework
f26ac172f3a29e9feb39db4d3d5730722317b6a1.json
Add tests for collection's only and except methods
tests/Support/SupportCollectionTest.php
@@ -412,6 +412,14 @@ public function testEvery() $this->assertEquals(['d'], $data->every(4, 3)->all()); } + public function testExcept() + { + $data = new Collection(['first' => 'Taylor', 'last' => 'Otwell', 'email' => 'taylorotwell@gmail.com']); + + $this->assertEquals(['first' => 'Taylor'], $data->except(['last', 'email', 'missing'])->all()); + $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->except(['last'])->all()); + } + public function testPluckWithArrayAndObjectValues() { $data = new Collection([(object) ['name' => 'taylor', 'email' => 'foo'], ['name' => 'dayle', 'email' => 'bar']]); @@ -834,6 +842,14 @@ public function testGettingMinItemsFromCollection() $this->assertNull($c->min()); } + public function testOnly() + { + $data = new Collection(['first' => 'Taylor', 'last' => 'Otwell', 'email' => 'taylorotwell@gmail.com']); + + $this->assertEquals(['first' => 'Taylor'], $data->only(['first', 'missing'])->all()); + $this->assertEquals(['first' => 'Taylor', 'email' => 'taylorotwell@gmail.com'], $data->only(['first', 'email'])->all()); + } + public function testGettingAvgItemsFromCollection() { $c = new Collection([(object) ['foo' => 10], (object) ['foo' => 20]]);
false
Other
laravel
framework
e3bc23b952466ceca259d028af2e3c8c0695b21c.json
Adjust docblock for Collection::pluck
src/Illuminate/Support/Collection.php
@@ -417,7 +417,7 @@ public function last(callable $callback = null, $default = null) } /** - * Get an array with the values of a given key. + * Get the values of a given key. * * @param string $value * @param string $key
false
Other
laravel
framework
706d0d6aafee7ac942000cffa55b84ff4b24f82e.json
Fix Arr::get usages
src/Illuminate/Broadcasting/BroadcastManager.php
@@ -121,7 +121,7 @@ protected function callCustomCreator(array $config) protected function createPusherDriver(array $config) { return new PusherBroadcaster( - new Pusher($config['key'], $config['secret'], $config['app_id'], array_get($config, 'options', [])) + new Pusher($config['key'], $config['secret'], $config['app_id'], Arr::get($config, 'options', [])) ); }
true
Other
laravel
framework
706d0d6aafee7ac942000cffa55b84ff4b24f82e.json
Fix Arr::get usages
src/Illuminate/Cache/CacheManager.php
@@ -200,7 +200,7 @@ protected function createRedisDriver(array $config) { $redis = $this->app['redis']; - $connection = Arr::get($config, 'connection', 'default') ?: 'default'; + $connection = Arr::get($config, 'connection', 'default'); return $this->repository(new RedisStore($redis, $this->getPrefix($config), $connection)); }
true
Other
laravel
framework
706d0d6aafee7ac942000cffa55b84ff4b24f82e.json
Fix Arr::get usages
src/Illuminate/Support/ViewErrorBag.php
@@ -33,7 +33,7 @@ public function hasBag($key = 'default') */ public function getBag($key) { - return Arr::get($this->bags, $key, new MessageBag); + return Arr::get($this->bags, $key) ?: new MessageBag; } /** @@ -90,7 +90,7 @@ public function __call($method, $parameters) */ public function __get($key) { - return Arr::get($this->bags, $key, new MessageBag); + return Arr::get($this->bags, $key) ?: new MessageBag; } /**
true
Other
laravel
framework
91e3510b447629dd609850779e63511941a1c25a.json
Add array_prepend helper
src/Illuminate/Support/helpers.php
@@ -243,6 +243,21 @@ function array_pluck($array, $value, $key = null) } } +if (! function_exists('array_prepend')) { + /** + * Push an item onto the beginning of an array. + * + * @param array $array + * @param mixed $value + * @param mixed $key + * @return array + */ + function array_prepend($array, $value, $key = null) + { + return Arr::prepend($array, $value, $key); + } +} + if (! function_exists('array_pull')) { /** * Get a value from the array, and remove it.
false
Other
laravel
framework
ea0e338626973e6a48202a28311b9bb590b7b783.json
Add prepend method to Arr class
src/Illuminate/Support/Arr.php
@@ -349,6 +349,25 @@ protected static function explodePluckParameters($value, $key) return [$value, $key]; } + /** + * Push an item onto the beginning of an array. + * + * @param array $array + * @param mixed $value + * @param mixed $key + * @return array + */ + public static function prepend($array, $value, $key = null) + { + if (is_null($key)) { + array_unshift($array, $value); + } else { + $array = [$key => $value] + $array; + } + + return $array; + } + /** * Get a value from the array, and remove it. *
true
Other
laravel
framework
ea0e338626973e6a48202a28311b9bb590b7b783.json
Add prepend method to Arr class
tests/Support/SupportArrTest.php
@@ -120,6 +120,15 @@ public function testPluckWithKeys() ], $test2); } + public function testPrepend() + { + $array = Arr::prepend(['one', 'two', 'three', 'four'], 'zero'); + $this->assertEquals(['zero', 'one', 'two', 'three', 'four'], $array); + + $array = Arr::prepend(['one' => 1, 'two' => 2], 0, 'zero'); + $this->assertEquals(['zero' => 0, 'one' => 1, 'two' => 2], $array); + } + public function testPull() { $array = ['name' => 'Desk', 'price' => 100];
true
Other
laravel
framework
7cdbd874d82d201e2a100b4684ec04e707a4184d.json
Allow collection prepend with a key
src/Illuminate/Support/Collection.php
@@ -522,11 +522,16 @@ public function pop() * Push an item onto the beginning of the collection. * * @param mixed $value + * @param mixed $key * @return $this */ - public function prepend($value) + public function prepend($value, $key = null) { - array_unshift($this->items, $value); + if (is_null($key)) { + array_unshift($this->items, $value); + } else { + $this->items = [$key => $value] + $this->items; + } return $this; }
true
Other
laravel
framework
7cdbd874d82d201e2a100b4684ec04e707a4184d.json
Allow collection prepend with a key
tests/Support/SupportCollectionTest.php
@@ -767,6 +767,15 @@ public function testPaginate() $this->assertEquals([], $c->forPage(3, 2)->all()); } + public function testPrepend() + { + $c = new Collection(['one', 'two', 'three', 'four']); + $this->assertEquals(['zero', 'one', 'two', 'three', 'four'], $c->prepend('zero')->all()); + + $c = new Collection(['one' => 1, 'two' => 2]); + $this->assertEquals(['zero' => 0, 'one' => 1, 'two' => 2], $c->prepend(0, 'zero')->all()); + } + public function testZip() { $c = new Collection([1, 2, 3]);
true
Other
laravel
framework
d4157a41b4768d7f6600b9999bff577fb293d72b.json
add testStepMayBeSet, fix mock values
tests/Database/DatabaseMigrationMigrateCommandTest.php
@@ -18,7 +18,7 @@ public function testBasicMigrationsCallMigratorWithProperArguments() $app->useDatabasePath(__DIR__); $command->setLaravel($app); $migrator->shouldReceive('setConnection')->once()->with(null); - $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false, null); + $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false, false); $migrator->shouldReceive('getNotes')->andReturn([]); $migrator->shouldReceive('repositoryExists')->once()->andReturn(true); @@ -33,7 +33,7 @@ public function testMigrationRepositoryCreatedWhenNecessary() $app->useDatabasePath(__DIR__); $command->setLaravel($app); $migrator->shouldReceive('setConnection')->once()->with(null); - $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false, null); + $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false, false); $migrator->shouldReceive('getNotes')->andReturn([]); $migrator->shouldReceive('repositoryExists')->once()->andReturn(false); $command->expects($this->once())->method('call')->with($this->equalTo('migrate:install'), $this->equalTo(['--database' => null])); @@ -48,7 +48,7 @@ public function testTheCommandMayBePretended() $app->useDatabasePath(__DIR__); $command->setLaravel($app); $migrator->shouldReceive('setConnection')->once()->with(null); - $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', true, null); + $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', true, false); $migrator->shouldReceive('getNotes')->andReturn([]); $migrator->shouldReceive('repositoryExists')->once()->andReturn(true); @@ -62,13 +62,27 @@ public function testTheDatabaseMayBeSet() $app->useDatabasePath(__DIR__); $command->setLaravel($app); $migrator->shouldReceive('setConnection')->once()->with('foo'); - $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false, null); + $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false, false); $migrator->shouldReceive('getNotes')->andReturn([]); $migrator->shouldReceive('repositoryExists')->once()->andReturn(true); $this->runCommand($command, ['--database' => 'foo']); } + public function testStepMayBeSet() + { + $command = new MigrateCommand($migrator = m::mock('Illuminate\Database\Migrations\Migrator'), __DIR__.'/vendor'); + $app = new ApplicationDatabaseMigrationStub(['path.database' => __DIR__]); + $app->useDatabasePath(__DIR__); + $command->setLaravel($app); + $migrator->shouldReceive('setConnection')->once()->with(null); + $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false, true); + $migrator->shouldReceive('getNotes')->andReturn([]); + $migrator->shouldReceive('repositoryExists')->once()->andReturn(true); + + $this->runCommand($command, ['--step' => true]); + } + protected function runCommand($command, $input = []) { return $command->run(new Symfony\Component\Console\Input\ArrayInput($input), new Symfony\Component\Console\Output\NullOutput);
false
Other
laravel
framework
50b6f556500c5d07416827c49e47077f08e857e3.json
Update the mocking
tests/Database/DatabaseMigrationMigrateCommandTest.php
@@ -18,7 +18,7 @@ public function testBasicMigrationsCallMigratorWithProperArguments() $app->useDatabasePath(__DIR__); $command->setLaravel($app); $migrator->shouldReceive('setConnection')->once()->with(null); - $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false); + $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false, null); $migrator->shouldReceive('getNotes')->andReturn([]); $migrator->shouldReceive('repositoryExists')->once()->andReturn(true); @@ -33,7 +33,7 @@ public function testMigrationRepositoryCreatedWhenNecessary() $app->useDatabasePath(__DIR__); $command->setLaravel($app); $migrator->shouldReceive('setConnection')->once()->with(null); - $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false); + $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false, null); $migrator->shouldReceive('getNotes')->andReturn([]); $migrator->shouldReceive('repositoryExists')->once()->andReturn(false); $command->expects($this->once())->method('call')->with($this->equalTo('migrate:install'), $this->equalTo(['--database' => null])); @@ -48,7 +48,7 @@ public function testTheCommandMayBePretended() $app->useDatabasePath(__DIR__); $command->setLaravel($app); $migrator->shouldReceive('setConnection')->once()->with(null); - $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', true); + $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', true, null); $migrator->shouldReceive('getNotes')->andReturn([]); $migrator->shouldReceive('repositoryExists')->once()->andReturn(true); @@ -62,7 +62,7 @@ public function testTheDatabaseMayBeSet() $app->useDatabasePath(__DIR__); $command->setLaravel($app); $migrator->shouldReceive('setConnection')->once()->with('foo'); - $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false); + $migrator->shouldReceive('run')->once()->with(__DIR__.'/migrations', false, null); $migrator->shouldReceive('getNotes')->andReturn([]); $migrator->shouldReceive('repositoryExists')->once()->andReturn(true);
false
Other
laravel
framework
8a2a2d5d9102ecab0cd4a69ffc073f09f03760e1.json
allow mocking protected methods on facades
src/Illuminate/Support/Facades/Facade.php
@@ -64,6 +64,8 @@ protected static function createFreshMockInstance($name) { static::$resolvedInstance[$name] = $mock = static::createMockByName($name); + $mock->shouldAllowMockingProtectedMethods(); + if (isset(static::$app)) { static::$app->instance($name, $mock); }
false
Other
laravel
framework
4c46c2294f135264dce48d4d178af4a45a9bf6fb.json
restore exception catching on result
src/Illuminate/Console/Application.php
@@ -61,7 +61,11 @@ public function call($command, array $parameters = []) $this->setCatchExceptions(false); - return $this->run(new ArrayInput($parameters->toArray()), $this->lastOutput); + $result = $this->run(new ArrayInput($parameters->toArray()), $this->lastOutput); + + $this->setCatchExceptions(true); + + return $result; } /**
false
Other
laravel
framework
3509d0b31d6c17d97b7e2e0d719c63a9c3837aa3.json
Move is_array check to internal method
src/Illuminate/Support/Collection.php
@@ -29,7 +29,7 @@ class Collection implements ArrayAccess, Arrayable, Countable, IteratorAggregate */ public function __construct($items = []) { - $this->items = is_array($items) ? $items : $this->getArrayableItems($items); + $this->items = $this->getArrayableItems($items); } /** @@ -1042,7 +1042,9 @@ public function __toString() */ protected function getArrayableItems($items) { - if ($items instanceof self) { + if (is_array($items)) { + return $items; + } elseif ($items instanceof self) { return $items->all(); } elseif ($items instanceof Arrayable) { return $items->toArray();
false
Other
laravel
framework
bdef94e517368568a896b5a03ad87eee394adccd.json
Fix some docblocks
src/Illuminate/Database/Query/JoinClause.php
@@ -60,7 +60,7 @@ public function __construct($type, $table) * * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` * - * @param string $first + * @param string|\Closure $first * @param string|null $operator * @param string|null $second * @param string $boolean @@ -97,7 +97,7 @@ public function on($first, $operator = null, $second = null, $boolean = 'and', $ /** * Add an "or on" clause to the join. * - * @param string $first + * @param string|\Closure $first * @param string|null $operator * @param string|null $second * @return \Illuminate\Database\Query\JoinClause @@ -110,7 +110,7 @@ public function orOn($first, $operator = null, $second = null) /** * Add an "on where" clause to the join. * - * @param string $first + * @param string|\Closure $first * @param string|null $operator * @param string|null $second * @param string $boolean @@ -124,7 +124,7 @@ public function where($first, $operator = null, $second = null, $boolean = 'and' /** * Add an "or on where" clause to the join. * - * @param string $first + * @param string|\Closure $first * @param string|null $operator * @param string|null $second * @return \Illuminate\Database\Query\JoinClause @@ -237,11 +237,11 @@ public function orWhereNotIn($column, array $values) */ public function nest(Closure $callback, $boolean = 'and') { - $join = new self($this->type, $this->table); + $join = new static($this->type, $this->table); $callback($join); - if ($clausesCount = count($join->clauses)) { + if (count($join->clauses)) { $nested = true; $this->clauses[] = compact('nested', 'join', 'boolean');
false
Other
laravel
framework
d6abdbfaf17ae629ebd27594e86d1a8480669e81.json
Add support for joins with nested conditions
src/Illuminate/Database/Query/Grammars/Grammar.php
@@ -169,6 +169,20 @@ protected function compileJoins(Builder $query, $joins) */ protected function compileJoinConstraint(array $clause) { + if ($clause['nested']) { + $clauses = []; + + foreach ($clause['join']->clauses as $nestedClause) { + $clauses[] = $this->compileJoinConstraint($nestedClause); + } + + $clauses[0] = $this->removeLeadingBoolean($clauses[0]); + + $clauses = implode(' ', $clauses); + + return "{$clause['boolean']} ({$clauses})"; + } + $first = $this->wrap($clause['first']); if ($clause['where']) {
true
Other
laravel
framework
d6abdbfaf17ae629ebd27594e86d1a8480669e81.json
Add support for joins with nested conditions
src/Illuminate/Database/Query/JoinClause.php
@@ -2,6 +2,9 @@ namespace Illuminate\Database\Query; +use Closure; +use InvalidArgumentException; + class JoinClause { /** @@ -58,14 +61,24 @@ public function __construct($type, $table) * on `contacts`.`user_id` = `users`.`id` and `contacts`.`info_id` = `info`.`id` * * @param string $first - * @param string $operator - * @param string $second + * @param string|null $operator + * @param string|null $second * @param string $boolean * @param bool $where * @return $this + * + * @throws \InvalidArgumentException */ - public function on($first, $operator, $second, $boolean = 'and', $where = false) + public function on($first, $operator = null, $second = null, $boolean = 'and', $where = false) { + if ($first instanceof Closure) { + return $this->nest($first, $boolean); + } + + if (func_num_args() < 3) { + throw new InvalidArgumentException('Not enough arguments for the on clause.'); + } + if ($where) { $this->bindings[] = $second; } @@ -74,7 +87,9 @@ public function on($first, $operator, $second, $boolean = 'and', $where = false) $second = count($second); } - $this->clauses[] = compact('first', 'operator', 'second', 'boolean', 'where'); + $nested = false; + + $this->clauses[] = compact('first', 'operator', 'second', 'boolean', 'where', 'nested'); return $this; } @@ -83,11 +98,11 @@ public function on($first, $operator, $second, $boolean = 'and', $where = false) * Add an "or on" clause to the join. * * @param string $first - * @param string $operator - * @param string $second + * @param string|null $operator + * @param string|null $second * @return \Illuminate\Database\Query\JoinClause */ - public function orOn($first, $operator, $second) + public function orOn($first, $operator = null, $second = null) { return $this->on($first, $operator, $second, 'or'); } @@ -96,12 +111,12 @@ public function orOn($first, $operator, $second) * Add an "on where" clause to the join. * * @param string $first - * @param string $operator - * @param string $second + * @param string|null $operator + * @param string|null $second * @param string $boolean * @return \Illuminate\Database\Query\JoinClause */ - public function where($first, $operator, $second, $boolean = 'and') + public function where($first, $operator = null, $second = null, $boolean = 'and') { return $this->on($first, $operator, $second, $boolean, true); } @@ -110,11 +125,11 @@ public function where($first, $operator, $second, $boolean = 'and') * Add an "or on where" clause to the join. * * @param string $first - * @param string $operator - * @param string $second + * @param string|null $operator + * @param string|null $second * @return \Illuminate\Database\Query\JoinClause */ - public function orWhere($first, $operator, $second) + public function orWhere($first, $operator = null, $second = null) { return $this->on($first, $operator, $second, 'or', true); } @@ -212,4 +227,27 @@ public function orWhereNotIn($column, array $values) { return $this->on($column, 'not in', $values, 'or', true); } + + /** + * Add a nested where statement to the query. + * + * @param \Closure $callback + * @param string $boolean + * @return \Illuminate\Database\Query\JoinClause + */ + public function nest(Closure $callback, $boolean = 'and') + { + $join = new self($this->type, $this->table); + + $callback($join); + + if ($clausesCount = count($join->clauses)) { + $nested = true; + + $this->clauses[] = compact('nested', 'join', 'boolean'); + $this->bindings = array_merge($this->bindings, $join->bindings); + } + + return $this; + } }
true
Other
laravel
framework
d6abdbfaf17ae629ebd27594e86d1a8480669e81.json
Add support for joins with nested conditions
tests/Database/DatabaseQueryBuilderTest.php
@@ -712,6 +712,31 @@ public function testJoinWhereNotIn() $this->assertEquals([48, 'baz', null], $builder->getBindings()); } + public function testJoinsWithNestedConditions() + { + $builder = $this->getBuilder(); + $builder->select('*')->from('users')->leftJoin('contacts', function ($j) { + $j->on('users.id', '=', 'contacts.id')->where(function($j) { + $j->where('contacts.country', '=', 'US')->orWhere('contacts.is_partner', '=', 1); + }); + }); + $this->assertEquals('select * from "users" left join "contacts" on "users"."id" = "contacts"."id" and ("contacts"."country" = ? or "contacts"."is_partner" = ?)', $builder->toSql()); + $this->assertEquals(['US', 1], $builder->getBindings()); + + $builder = $this->getBuilder(); + $builder->select('*')->from('users')->leftJoin('contacts', function ($j) { + $j->on('users.id', '=', 'contacts.id')->where('contacts.is_active', '=', 1)->orOn(function($j) { + $j->orWhere(function($j) { + $j->where('contacts.country', '=', 'UK')->orOn('contacts.type', '=', 'users.type'); + })->where(function($j) { + $j->where('contacts.country', '=', 'US')->orWhereNull('contacts.is_partner'); + }); + }); + }); + $this->assertEquals('select * from "users" left join "contacts" on "users"."id" = "contacts"."id" and "contacts"."is_active" = ? or (("contacts"."country" = ? or "contacts"."type" = "users"."type") and ("contacts"."country" = ? or "contacts"."is_partner" is null))', $builder->toSql()); + $this->assertEquals([1, 'UK', 'US'], $builder->getBindings()); + } + public function testRawExpressionsInSelect() { $builder = $this->getBuilder();
true
Other
laravel
framework
a4ea877d2bb6a68796b244a741594968796c1c4e.json
update laravel version
src/Illuminate/Foundation/Application.php
@@ -25,7 +25,7 @@ class Application extends Container implements ApplicationContract, HttpKernelIn * * @var string */ - const VERSION = '5.1.22 (LTS)'; + const VERSION = '5.1.23 (LTS)'; /** * The base path for the Laravel installation.
false
Other
laravel
framework
9c9f817372a644a2e233c3af543b2120fcfcf2d9.json
Import Dispatcher contract
src/Illuminate/Foundation/Bus/DispatchesJobs.php
@@ -3,6 +3,7 @@ namespace Illuminate\Foundation\Bus; use ArrayAccess; +use Illuminate\Contracts\Bus\Dispatcher; trait DispatchesJobs { @@ -14,7 +15,7 @@ trait DispatchesJobs */ protected function dispatch($job) { - return app(\Illuminate\Contracts\Bus\Dispatcher::class)->dispatch($job); + return app(Dispatcher::class)->dispatch($job); } /** @@ -26,7 +27,7 @@ protected function dispatch($job) */ protected function dispatchFromArray($job, array $array) { - return app(\Illuminate\Contracts\Bus\Dispatcher::class)->dispatchFromArray($job, $array); + return app(Dispatcher::class)->dispatchFromArray($job, $array); } /** @@ -39,6 +40,6 @@ protected function dispatchFromArray($job, array $array) */ protected function dispatchFrom($job, ArrayAccess $source, $extras = []) { - return app(\Illuminate\Contracts\Bus\Dispatcher::class)->dispatchFrom($job, $source, $extras); + return app(Dispatcher::class)->dispatchFrom($job, $source, $extras); } }
false
Other
laravel
framework
2c4c93175db79b37331b07e561d7e2232894b7f8.json
Remove useless foreach.
src/Illuminate/Routing/UrlGenerator.php
@@ -357,9 +357,7 @@ protected function replaceRouteParameters($path, array &$parameters) return $match[0]; } - foreach ($parameters as $key => $value) { - return array_shift($parameters); - } + return array_shift($parameters); }, $path); }
false
Other
laravel
framework
d18451f841dc95cf919602c473e88103cfe69994.json
Remove unused refrence
src/Illuminate/Foundation/Console/RouteListCommand.php
@@ -4,7 +4,6 @@ use Illuminate\Support\Arr; use Illuminate\Support\Str; -use Illuminate\Http\Request; use Illuminate\Routing\Route; use Illuminate\Routing\Router; use Illuminate\Console\Command;
false
Other
laravel
framework
1c71e7785655e5084630fdee58ed290245a69f4c.json
allow 0 limit
src/Illuminate/Database/Query/Builder.php
@@ -1207,7 +1207,7 @@ public function limit($value) { $property = $this->unions ? 'unionLimit' : 'limit'; - if ($value > 0) { + if ($value >= 0) { $this->$property = $value; }
false
Other
laravel
framework
c24371e590879a3916be5cc4daa4aa9f646b660a.json
Add new test for implicit each.
tests/Validation/ValidationValidatorTest.php
@@ -1762,6 +1762,18 @@ public function testValidateEach() $this->assertTrue($v->passes()); } + public function testValidateImplicitEachWithAsterisks() + { + $trans = $this->getRealTranslator(); + $data = ['foo' => [5, 10, 15]]; + + $v = new Validator($trans, $data, ['foo' => 'Array', 'foo.*' => 'Numeric|Min:6|Max:16']); + $this->assertFalse($v->passes()); + + $v = new Validator($trans, $data, ['foo' => 'Array', 'foo.*' => 'Numeric|Min:4|Max:16']); + $this->assertTrue($v->passes()); + } + public function testValidateEachWithNonIndexedArray() { $trans = $this->getRealTranslator();
false
Other
laravel
framework
2bb3fae85458b0bc94554969d9e22bdf0c221152.json
add unique method to message bag.
src/Illuminate/Support/MessageBag.php
@@ -158,6 +158,17 @@ public function all($format = null) return $all; } + /** + * Get all of the unique messages for every key in the bag. + * + * @param string $format + * @return array + */ + public function unique($format = null) + { + return array_unique($this->all($format)); + } + /** * Format an array of messages. *
false
Other
laravel
framework
5505d26ba67746c3e229a789ba5f62ebbeea1c3d.json
Support temporary tables in schema builder
src/Illuminate/Database/Schema/Blueprint.php
@@ -30,6 +30,13 @@ class Blueprint */ protected $commands = []; + /** + * Whether to make the table temporary. + * + * @var bool + */ + public $temporary = false; + /** * The storage engine that should be used for the table. * @@ -180,6 +187,16 @@ public function create() return $this->addCommand('create'); } + /** + * Indicate that the table needs to be temporary. + * + * @return void + */ + public function temporary() + { + $this->temporary = true; + } + /** * Indicate that the table should be dropped. *
true
Other
laravel
framework
5505d26ba67746c3e229a789ba5f62ebbeea1c3d.json
Support temporary tables in schema builder
src/Illuminate/Database/Schema/Grammars/MySqlGrammar.php
@@ -54,7 +54,11 @@ public function compileCreate(Blueprint $blueprint, Fluent $command, Connection { $columns = implode(', ', $this->getColumns($blueprint)); - $sql = 'create table '.$this->wrapTable($blueprint)." ($columns)"; + $sql = 'create'; + if ($blueprint->temporary === true) { + $sql .= ' temporary'; + } + $sql .= ' table '.$this->wrapTable($blueprint)." ($columns)"; // Once we have the primary SQL, we can add the encoding option to the SQL for // the table. Then, we can check if a storage engine has been supplied for
true
Other
laravel
framework
5505d26ba67746c3e229a789ba5f62ebbeea1c3d.json
Support temporary tables in schema builder
src/Illuminate/Database/Schema/Grammars/PostgresGrammar.php
@@ -53,7 +53,13 @@ public function compileCreate(Blueprint $blueprint, Fluent $command) { $columns = implode(', ', $this->getColumns($blueprint)); - return 'create table '.$this->wrapTable($blueprint)." ($columns)"; + $sql = 'create'; + if ($blueprint->temporary === true) { + $sql .= ' temporary'; + } + $sql .= ' table '.$this->wrapTable($blueprint)." ($columns)"; + + return $sql; } /**
true
Other
laravel
framework
5505d26ba67746c3e229a789ba5f62ebbeea1c3d.json
Support temporary tables in schema builder
src/Illuminate/Database/Schema/Grammars/SQLiteGrammar.php
@@ -54,7 +54,11 @@ public function compileCreate(Blueprint $blueprint, Fluent $command) { $columns = implode(', ', $this->getColumns($blueprint)); - $sql = 'create table '.$this->wrapTable($blueprint)." ($columns"; + $sql = 'create'; + if ($blueprint->temporary === true) { + $sql .= ' temporary'; + } + $sql .= ' table '.$this->wrapTable($blueprint)." ($columns"; // SQLite forces primary keys to be added when the table is initially created // so we will need to check for a primary key commands and add the columns
true
Other
laravel
framework
beb65db9b8f3d6f0d566f09429465d2033cff6e6.json
update maximum string length.
src/Illuminate/Session/Console/stubs/database.stub
@@ -15,7 +15,7 @@ class CreateSessionsTable extends Migration Schema::create('sessions', function (Blueprint $table) { $table->string('id')->unique(); $table->integer('user_id')->nullable(); - $table->string('ip_address', 25)->nullable(); + $table->string('ip_address', 45)->nullable(); $table->text('user_agent')->nullable(); $table->text('payload'); $table->integer('last_activity');
false
Other
laravel
framework
34acd3c9a7241c10af9c7e3444bb29de3b7f2b09.json
Add user agent to 5.2 session database.
src/Illuminate/Session/Console/stubs/database.stub
@@ -16,6 +16,7 @@ class CreateSessionsTable extends Migration $table->string('id')->unique(); $table->integer('user_id')->nullable(); $table->string('ip_address', 25)->nullable(); + $table->text('user_agent')->nullable(); $table->text('payload'); $table->integer('last_activity'); });
true
Other
laravel
framework
34acd3c9a7241c10af9c7e3444bb29de3b7f2b09.json
Add user agent to 5.2 session database.
src/Illuminate/Session/DatabaseSessionHandler.php
@@ -110,12 +110,20 @@ protected function getDefaultPayload($data) { $payload = ['payload' => base64_encode($data), 'last_activity' => time()]; - if ($this->container && $this->container->bound(Guard::class)) { - $payload['user_id'] = $this->container->make(Guard::class)->id(); + if (! $container = $this->container) { + return $payload; } - if ($this->container && $this->container->bound('request')) { - $payload['ip_address'] = $this->container->make('request')->ip(); + if ($container->bound(Guard::class)) { + $payload['user_id'] = $container->make(Guard::class)->id(); + } + + if ($container->bound('request')) { + $payload['ip_address'] = $container->make('request')->ip(); + + $payload['user_agent'] = substr( + (string) $container->make('request')->header('User-Agent'), 0, 500 + ); } return $payload;
true
Other
laravel
framework
ea9432aa1036c45b9af78af7ab111d2da4ca32b5.json
Add functions for encrypt / decrypt.
src/Illuminate/Foundation/helpers.php
@@ -242,6 +242,19 @@ function database_path($path = '') } } +if (! function_exists('decrypt')) { + /** + * Decrypt the given value. + * + * @param string $value + * @return string + */ + function decrypt($value) + { + return app('encrypter')->decrypt($value); + } +} + if (! function_exists('delete')) { /** * Register a new DELETE route with the router. @@ -281,6 +294,19 @@ function elixir($file) } } +if (! function_exists('encrypt')) { + /** + * Encrypt the given value. + * + * @param string $value + * @return string + */ + function encrypt($value) + { + return app('encrypter')->encrypt($value); + } +} + if (! function_exists('env')) { /** * Gets the value of an environment variable. Supports boolean, empty and null.
false
Other
laravel
framework
19077801dbd633cab1284a5cba00fedd0dadf546.json
trim request on passthrough
src/Illuminate/Foundation/Http/Middleware/VerifyCsrfToken.php
@@ -62,7 +62,7 @@ public function handle($request, Closure $next) protected function shouldPassThrough($request) { foreach ($this->except as $except) { - if ($request->is($except)) { + if ($request->is(trim($except, '/'))) { return true; } }
false