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
c4ccd93842e109fbea6c7bf6f875aaf1c0cdf9ab.json
Let apiResource support except option. (#24319)
src/Illuminate/Routing/Router.php
@@ -328,8 +328,14 @@ public function apiResources(array $resources) */ public function apiResource($name, $controller, array $options = []) { + $only = ['index', 'show', 'store', 'update', 'destroy']; + + if (isset($options['except'])) { + $only = array_diff($only, (array) $options['except']); + } + return $this->resource($name, $controller, array_merge([ - 'only' => ['index', 'show', 'store', 'update', 'destroy'], + 'only' => $only, ], $options)); }
true
Other
laravel
framework
c4ccd93842e109fbea6c7bf6f875aaf1c0cdf9ab.json
Let apiResource support except option. (#24319)
tests/Routing/RouteRegistrarTest.php
@@ -269,6 +269,31 @@ public function testUserCanRegisterApiResource() $this->assertFalse($this->router->getRoutes()->hasNamedRoute('users.edit')); } + public function testUserCanRegisterApiResourceWithExceptOption() + { + $this->router->apiResource('users', \Illuminate\Tests\Routing\RouteRegistrarControllerStub::class, [ + 'except' => ['destroy'], + ]); + + $this->assertCount(4, $this->router->getRoutes()); + + $this->assertFalse($this->router->getRoutes()->hasNamedRoute('users.create')); + $this->assertFalse($this->router->getRoutes()->hasNamedRoute('users.edit')); + $this->assertFalse($this->router->getRoutes()->hasNamedRoute('users.destroy')); + } + + public function testUserCanRegisterApiResourceWithOnlyOption() + { + $this->router->apiResource('users', \Illuminate\Tests\Routing\RouteRegistrarControllerStub::class, [ + 'only' => ['index', 'show'], + ]); + + $this->assertCount(2, $this->router->getRoutes()); + + $this->assertTrue($this->router->getRoutes()->hasNamedRoute('users.index')); + $this->assertTrue($this->router->getRoutes()->hasNamedRoute('users.show')); + } + public function testCanNameRoutesOnRegisteredResource() { $this->router->resource('comments', 'Illuminate\Tests\Routing\RouteRegistrarControllerStub')
true
Other
laravel
framework
5bd6c713a8b0c7716236c2d0485d4f20927a4866.json
reset doc block (#24300) Request to revert #24291 as discussed on that pull request.
src/Illuminate/Support/Facades/Validator.php
@@ -3,7 +3,7 @@ namespace Illuminate\Support\Facades; /** - * @method static \Illuminate\Validation\Validator make(array $data, array $rules, array $messages = [], array $customAttributes = []) + * @method static \Illuminate\Contracts\Validation\Validator make(array $data, array $rules, array $messages = [], array $customAttributes = []) * @method static void extend(string $rule, \Closure | string $extension, string $message = null) * @method static void extendImplicit(string $rule, \Closure | string $extension, string $message = null) * @method static void replacer(string $rule, \Closure | string $replacer)
false
Other
laravel
framework
0bf5f8ec0c519ccb558c3280b5ce09f4f3f7486e.json
Apply fixes from StyleCI (#24292)
tests/Database/DatabaseEloquentIntegrationTest.php
@@ -3,7 +3,6 @@ namespace Illuminate\Tests\Database; use Exception; -use ReflectionObject; use PHPUnit\Framework\TestCase; use Illuminate\Database\Eloquent\Collection; use Illuminate\Database\Eloquent\SoftDeletes;
false
Other
laravel
framework
75d239b354ea8c12a22bfb180e809e0c171b6bfb.json
update doc block (#24291) make returns `\Illuminate\Validation\Validator`
src/Illuminate/Support/Facades/Validator.php
@@ -3,7 +3,7 @@ namespace Illuminate\Support\Facades; /** - * @method static \Illuminate\Contracts\Validation\Validator make(array $data, array $rules, array $messages = [], array $customAttributes = []) + * @method static \Illuminate\Validation\Validator make(array $data, array $rules, array $messages = [], array $customAttributes = []) * @method static void extend(string $rule, \Closure | string $extension, string $message = null) * @method static void extendImplicit(string $rule, \Closure | string $extension, string $message = null) * @method static void replacer(string $rule, \Closure | string $replacer)
false
Other
laravel
framework
8d1ade1daedbedee151213133732971f1f52e667.json
Remove extra line
tests/Database/DatabaseEloquentModelTest.php
@@ -1718,7 +1718,6 @@ public function testWithoutTouchingOnCallback() $called = false; - Model::withoutTouchingOn([EloquentModelStub::class], function () use (&$called, $model) { $called = true; });
false
Other
laravel
framework
8c37b0d0c0821225b4c89a7e3b4c4aeb1f560471.json
Fix $withCount binding problems
src/Illuminate/Database/Eloquent/Builder.php
@@ -219,7 +219,7 @@ public function whereKeyNot($id) public function where($column, $operator = null, $value = null, $boolean = 'and') { if ($column instanceof Closure) { - $query = $this->model->newQueryWithoutScopes(); + $query = $this->model->newUneagerQueryWithoutScopes(); $column($query);
true
Other
laravel
framework
8c37b0d0c0821225b4c89a7e3b4c4aeb1f560471.json
Fix $withCount binding problems
src/Illuminate/Database/Eloquent/Model.php
@@ -530,7 +530,7 @@ public function push() */ public function save(array $options = []) { - $query = $this->newQueryWithoutScopes(); + $query = $this->newUneagerQueryWithoutScopes(); // If the "saving" event returns false we'll bail out of the save and return // false, indicating that the save failed. This provides a chance for any @@ -815,7 +815,7 @@ public function forceDelete() */ protected function performDeleteOnModel() { - $this->setKeysForSaveQuery($this->newQueryWithoutScopes())->delete(); + $this->setKeysForSaveQuery($this->newUneagerQueryWithoutScopes())->delete(); $this->exists = false; } @@ -873,15 +873,25 @@ public function registerGlobalScopes($builder) * @return \Illuminate\Database\Eloquent\Builder|static */ public function newQueryWithoutScopes() + { + return $this->newUneagerQueryWithoutScopes() + ->with($this->with) + ->withCount($this->withCount); + } + + /** + * Get a new query builder that doesn't have any global scopes or eager loading. + * + * @return \Illuminate\Database\Eloquent\Builder|static + */ + public function newUneagerQueryWithoutScopes() { $builder = $this->newEloquentBuilder($this->newBaseQueryBuilder()); // Once we have the query builders, we will set the model instances so the // builder can easily access any information it may need from the model // while it is constructing and executing various queries against it. - return $builder->setModel($this) - ->with($this->with) - ->withCount($this->withCount); + return $builder->setModel($this); } /**
true
Other
laravel
framework
8c37b0d0c0821225b4c89a7e3b4c4aeb1f560471.json
Fix $withCount binding problems
src/Illuminate/Database/Eloquent/SoftDeletes.php
@@ -49,7 +49,7 @@ protected function performDeleteOnModel() if ($this->forceDeleting) { $this->exists = false; - return $this->newQueryWithoutScopes()->where($this->getKeyName(), $this->getKey())->forceDelete(); + return $this->newUneagerQueryWithoutScopes()->where($this->getKeyName(), $this->getKey())->forceDelete(); } return $this->runSoftDelete(); @@ -62,7 +62,7 @@ protected function performDeleteOnModel() */ protected function runSoftDelete() { - $query = $this->newQueryWithoutScopes()->where($this->getKeyName(), $this->getKey()); + $query = $this->newUneagerQueryWithoutScopes()->where($this->getKeyName(), $this->getKey()); $time = $this->freshTimestamp();
true
Other
laravel
framework
8c37b0d0c0821225b4c89a7e3b4c4aeb1f560471.json
Fix $withCount binding problems
tests/Database/DatabaseEloquentBuilderTest.php
@@ -575,7 +575,7 @@ public function testNestedWhere() $nestedRawQuery = $this->getMockQueryBuilder(); $nestedQuery->shouldReceive('getQuery')->once()->andReturn($nestedRawQuery); $model = $this->getMockModel()->makePartial(); - $model->shouldReceive('newQueryWithoutScopes')->once()->andReturn($nestedQuery); + $model->shouldReceive('newUneagerQueryWithoutScopes')->once()->andReturn($nestedQuery); $builder = $this->getBuilder(); $builder->getQuery()->shouldReceive('from'); $builder->setModel($model);
true
Other
laravel
framework
8c37b0d0c0821225b4c89a7e3b4c4aeb1f560471.json
Fix $withCount binding problems
tests/Database/DatabaseEloquentModelTest.php
@@ -227,11 +227,11 @@ public function testWithMethodCallsQueryBuilderCorrectlyWithArray() public function testUpdateProcess() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('where')->once()->with('id', '=', 1); $query->shouldReceive('update')->once()->with(['name' => 'taylor'])->andReturn(1); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->once())->method('updateTimestamps'); $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher')); $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(true); @@ -250,11 +250,11 @@ public function testUpdateProcess() public function testUpdateProcessDoesntOverrideTimestamps() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('where')->once()->with('id', '=', 1); $query->shouldReceive('update')->once()->with(['created_at' => 'foo', 'updated_at' => 'bar'])->andReturn(1); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher')); $events->shouldReceive('until'); $events->shouldReceive('fire'); @@ -269,9 +269,9 @@ public function testUpdateProcessDoesntOverrideTimestamps() public function testSaveIsCancelledIfSavingEventReturnsFalse() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher')); $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(false); $model->exists = true; @@ -281,9 +281,9 @@ public function testSaveIsCancelledIfSavingEventReturnsFalse() public function testUpdateIsCancelledIfUpdatingEventReturnsFalse() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher')); $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(true); $events->shouldReceive('until')->once()->with('eloquent.updating: '.get_class($model), $model)->andReturn(false); @@ -295,9 +295,9 @@ public function testUpdateIsCancelledIfUpdatingEventReturnsFalse() public function testEventsCanBeFiredWithCustomEventObjects() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelEventObjectStub')->setMethods(['newQueryWithoutScopes'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelEventObjectStub')->setMethods(['newUneagerQueryWithoutScopes'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher')); $events->shouldReceive('until')->once()->with(m::type(EloquentModelSavingEventStub::class))->andReturn(false); $model->exists = true; @@ -307,12 +307,12 @@ public function testEventsCanBeFiredWithCustomEventObjects() public function testUpdateProcessWithoutTimestamps() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelEventObjectStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'fireModelEvent'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelEventObjectStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'fireModelEvent'])->getMock(); $model->timestamps = false; $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('where')->once()->with('id', '=', 1); $query->shouldReceive('update')->once()->with(['name' => 'taylor'])->andReturn(1); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->never())->method('updateTimestamps'); $model->expects($this->any())->method('fireModelEvent')->will($this->returnValue(true)); @@ -325,11 +325,11 @@ public function testUpdateProcessWithoutTimestamps() public function testUpdateUsesOldPrimaryKey() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('where')->once()->with('id', '=', 1); $query->shouldReceive('update')->once()->with(['id' => 2, 'foo' => 'bar'])->andReturn(1); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->once())->method('updateTimestamps'); $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher')); $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(true); @@ -456,11 +456,11 @@ public function testFromDateTime() public function testInsertProcess() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with(['name' => 'taylor'], 'id')->andReturn(1); $query->shouldReceive('getConnection')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->once())->method('updateTimestamps'); $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher')); @@ -475,11 +475,11 @@ public function testInsertProcess() $this->assertEquals(1, $model->id); $this->assertTrue($model->exists); - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insert')->once()->with(['name' => 'taylor']); $query->shouldReceive('getConnection')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->once())->method('updateTimestamps'); $model->setIncrementing(false); @@ -498,10 +498,10 @@ public function testInsertProcess() public function testInsertIsCancelledIfCreatingEventReturnsFalse() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('getConnection')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->setEventDispatcher($events = m::mock('Illuminate\Contracts\Events\Dispatcher')); $events->shouldReceive('until')->once()->with('eloquent.saving: '.get_class($model), $model)->andReturn(true); $events->shouldReceive('until')->once()->with('eloquent.creating: '.get_class($model), $model)->andReturn(false); @@ -512,11 +512,11 @@ public function testInsertIsCancelledIfCreatingEventReturnsFalse() public function testDeleteProperlyDeletesModel() { - $model = $this->getMockBuilder('Illuminate\Database\Eloquent\Model')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'touchOwners'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Database\Eloquent\Model')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'touchOwners'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('where')->once()->with('id', '=', 1)->andReturn($query); $query->shouldReceive('delete')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->once())->method('touchOwners'); $model->exists = true; $model->id = 1; @@ -525,11 +525,11 @@ public function testDeleteProperlyDeletesModel() public function testPushNoRelations() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with(['name' => 'taylor'], 'id')->andReturn(1); $query->shouldReceive('getConnection')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->once())->method('updateTimestamps'); $model->name = 'taylor'; @@ -542,11 +542,11 @@ public function testPushNoRelations() public function testPushEmptyOneRelation() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with(['name' => 'taylor'], 'id')->andReturn(1); $query->shouldReceive('getConnection')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->once())->method('updateTimestamps'); $model->name = 'taylor'; @@ -561,20 +561,20 @@ public function testPushEmptyOneRelation() public function testPushOneRelation() { - $related1 = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $related1 = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with(['name' => 'related1'], 'id')->andReturn(2); $query->shouldReceive('getConnection')->once(); - $related1->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $related1->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $related1->expects($this->once())->method('updateTimestamps'); $related1->name = 'related1'; $related1->exists = false; - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with(['name' => 'taylor'], 'id')->andReturn(1); $query->shouldReceive('getConnection')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->once())->method('updateTimestamps'); $model->name = 'taylor'; @@ -592,11 +592,11 @@ public function testPushOneRelation() public function testPushEmptyManyRelation() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with(['name' => 'taylor'], 'id')->andReturn(1); $query->shouldReceive('getConnection')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->once())->method('updateTimestamps'); $model->name = 'taylor'; @@ -611,29 +611,29 @@ public function testPushEmptyManyRelation() public function testPushManyRelation() { - $related1 = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $related1 = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with(['name' => 'related1'], 'id')->andReturn(2); $query->shouldReceive('getConnection')->once(); - $related1->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $related1->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $related1->expects($this->once())->method('updateTimestamps'); $related1->name = 'related1'; $related1->exists = false; - $related2 = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $related2 = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with(['name' => 'related2'], 'id')->andReturn(3); $query->shouldReceive('getConnection')->once(); - $related2->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $related2->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $related2->expects($this->once())->method('updateTimestamps'); $related2->name = 'related2'; $related2->exists = false; - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with(['name' => 'taylor'], 'id')->andReturn(1); $query->shouldReceive('getConnection')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $model->expects($this->once())->method('updateTimestamps'); $model->name = 'taylor'; @@ -1648,23 +1648,23 @@ public function testNonExistingAttributeWithInternalMethodNameDoesntCallMethod() public function testIntKeyTypePreserved() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with([], 'id')->andReturn(1); $query->shouldReceive('getConnection')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $this->assertTrue($model->save()); $this->assertEquals(1, $model->id); } public function testStringKeyTypePreserved() { - $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentKeyTypeModelStub')->setMethods(['newQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); + $model = $this->getMockBuilder('Illuminate\Tests\Database\EloquentKeyTypeModelStub')->setMethods(['newUneagerQueryWithoutScopes', 'updateTimestamps', 'refresh'])->getMock(); $query = m::mock('Illuminate\Database\Eloquent\Builder'); $query->shouldReceive('insertGetId')->once()->with([], 'id')->andReturn('string id'); $query->shouldReceive('getConnection')->once(); - $model->expects($this->once())->method('newQueryWithoutScopes')->will($this->returnValue($query)); + $model->expects($this->once())->method('newUneagerQueryWithoutScopes')->will($this->returnValue($query)); $this->assertTrue($model->save()); $this->assertEquals('string id', $model->id);
true
Other
laravel
framework
8c37b0d0c0821225b4c89a7e3b4c4aeb1f560471.json
Fix $withCount binding problems
tests/Database/DatabaseSoftDeletingTraitTest.php
@@ -17,7 +17,7 @@ public function testDeleteSetsSoftDeletedColumn() $model = m::mock('Illuminate\Tests\Database\DatabaseSoftDeletingTraitStub'); $model->shouldDeferMissing(); // $model->shouldReceive('newQuery')->andReturn($query = m::mock('stdClass')); - $model->shouldReceive('newQueryWithoutScopes')->andReturn($query = m::mock('stdClass')); + $model->shouldReceive('newUneagerQueryWithoutScopes')->andReturn($query = m::mock('stdClass')); $query->shouldReceive('where')->once()->with('id', 1)->andReturn($query); $query->shouldReceive('update')->once()->with([ 'deleted_at' => 'date-time',
true
Other
laravel
framework
370dbcfb573b917c963b7ba6fc3f1c44e85863a7.json
Add missing return docs and fix cs. (#24235)
src/Illuminate/Notifications/HasDatabaseNotifications.php
@@ -6,28 +6,31 @@ trait HasDatabaseNotifications { /** * Get the entity's notifications. + * + * @return \Illuminate\Database\Eloquent\Relations\MorphMany */ public function notifications() { - return $this->morphMany(DatabaseNotification::class, 'notifiable') - ->orderBy('created_at', 'desc'); + return $this->morphMany(DatabaseNotification::class, 'notifiable')->orderBy('created_at', 'desc'); } /** * Get the entity's read notifications. + * + * @return \Illuminate\Database\Query\Builder */ public function readNotifications() { - return $this->notifications() - ->whereNotNull('read_at'); + return $this->notifications()->whereNotNull('read_at'); } /** * Get the entity's unread notifications. + * + * @return \Illuminate\Database\Query\Builder */ public function unreadNotifications() { - return $this->notifications() - ->whereNull('read_at'); + return $this->notifications()->whereNull('read_at'); } }
false
Other
laravel
framework
2ca07e8ac7c3b5af8a75c4bb19f49b60988d7e22.json
Use static instead of Event
src/Illuminate/Support/Facades/Event.php
@@ -32,14 +32,14 @@ public static function fake($eventsToFake = []) */ public static function fakeFor(callable $callable, array $eventsToFake = []) { - $initialDispatcher = Event::getFacadeRoot(); + $initialDispatcher = static::getFacadeRoot(); - Event::fake($eventsToFake); + static::fake($eventsToFake); return tap($callable(), function () use ($initialDispatcher) { Model::setEventDispatcher($initialDispatcher); - Event::swap($initialDispatcher); + static::swap($initialDispatcher); }); }
false
Other
laravel
framework
ca75ec83c325894206283bc0653c8fca5c4fa66d.json
add release notes for v5.6.22
CHANGELOG-5.6.md
@@ -1,5 +1,15 @@ # Release Notes for 5.6.x +## v5.6.22 (2018-05-15) + +### Added +- Added `Collection::loadMissing()` method ([#24166](https://github.com/laravel/framework/pull/24166), [#24215](https://github.com/laravel/framework/pull/24215)) + +### Changed +- Support updating NPM dependencies from preset ([#24189](https://github.com/laravel/framework/pull/24189), [a6542b0](https://github.com/laravel/framework/commit/a6542b0972a1a92c1249689d3e1b46b3bc4e59fa)) +- Support returning `Responsable` from middleware ([#24201](https://github.com/laravel/framework/pull/24201)) + + ## v5.6.21 (2018-05-08) ### Added
false
Other
laravel
framework
bdc791185a364455fc56ed96d8838d64582dc4a9.json
Add closure support to loadMissing()
src/Illuminate/Database/Eloquent/Collection.php
@@ -74,8 +74,18 @@ public function loadMissing($relations) $relations = func_get_args(); } - foreach ($relations as $relation) { - $this->loadMissingRelation($this, explode('.', $relation)); + foreach ($relations as $key => $value) { + if (is_numeric($key)) { + $key = $value; + } + + $path = array_combine($segments = explode('.', $key), $segments); + + if (is_callable($value)) { + $path[end($segments)] = $value; + } + + $this->loadMissingRelation($this, $path); } return $this; @@ -90,9 +100,13 @@ public function loadMissing($relations) */ protected function loadMissingRelation(Collection $models, array $path) { - $relation = array_shift($path); + $relation = array_splice($path, 0, 1); + + $name = explode(':', key($relation))[0]; - $name = explode(':', $relation)[0]; + if (is_string(reset($relation))) { + $relation = reset($relation); + } $models->filter(function ($model) use ($name) { return ! is_null($model) && ! $model->relationLoaded($name);
true
Other
laravel
framework
bdc791185a364455fc56ed96d8838d64582dc4a9.json
Add closure support to loadMissing()
tests/Integration/Database/EloquentCollectionLoadMissingTest.php
@@ -59,6 +59,21 @@ public function testLoadMissing() $this->assertTrue($posts[0]->comments[1]->parent->relationLoaded('revisions')); $this->assertFalse(array_key_exists('post_id', $posts[0]->comments[1]->parent->getAttributes())); } + + public function testLoadMissingWithClosure() + { + $posts = Post::with('comments')->get(); + + \DB::enableQueryLog(); + + $posts->loadMissing(['comments.parent' => function ($query) { + $query->select('id'); + }]); + + $this->assertCount(1, \DB::getQueryLog()); + $this->assertTrue($posts[0]->comments[0]->relationLoaded('parent')); + $this->assertFalse(array_key_exists('post_id', $posts[0]->comments[1]->parent->getAttributes())); + } } class Comment extends Model
true
Other
laravel
framework
35a8805603b63e18949cab5bb1c260261ddc1435.json
Update helpers.php (#24188) Fixing a comment (minor).
src/Illuminate/Support/helpers.php
@@ -390,7 +390,7 @@ function class_basename($class) if (! function_exists('class_uses_recursive')) { /** - * Returns all traits used by a class, its subclasses and trait of their traits. + * Returns all traits used by a class, its parent classes and trait of their traits. * * @param object|string $class * @return array
false
Other
laravel
framework
52a6e51d672ed65574733cc8be8652ebd2efad99.json
Apply fixes from StyleCI (#24181)
tests/Database/DatabaseEloquentBelongsToManySyncReturnValueTypeTest.php
@@ -71,23 +71,22 @@ protected function seedData() BelongsToManySyncTestTestUser::create(['id' => 1, 'email' => 'taylorotwell@gmail.com']); BelongsToManySyncTestTestArticle::insert([ ['id' => '7b7306ae-5a02-46fa-a84c-9538f45c7dd4', 'title' => 'uuid title'], - ['id' => (string)(PHP_INT_MAX+1), 'title' => 'Another title'], - ['id' => '1', 'title' => 'Another title'] + ['id' => (string) (PHP_INT_MAX + 1), 'title' => 'Another title'], + ['id' => '1', 'title' => 'Another title'], ]); } public function testSyncReturnValueType() { $this->seedData(); - $user = BelongsToManySyncTestTestUser::query()->first(); $articleIDs = BelongsToManySyncTestTestArticle::all()->pluck('id')->toArray(); $changes = $user->articles()->sync($articleIDs); collect($changes['attached'])->map(function ($id) { - $this->assertTrue(gettype($id) === (new BelongsToManySyncTestTestArticle)->getKeyType()); + $this->assertTrue(gettype($id) === (new BelongsToManySyncTestTestArticle)->getKeyType()); }); } @@ -124,7 +123,6 @@ public function articles() } } - class BelongsToManySyncTestTestArticle extends Eloquent { protected $table = 'articles';
false
Other
laravel
framework
9e2017064df6e7681140065ca484bb3a469b67c3.json
Add a new interfact for redis connections Signed-off-by: Hunter Skrasek <hunterskrasek@me.com>
src/Illuminate/Contracts/Redis/Connections/Connection.php
@@ -0,0 +1,35 @@ +<?php + +namespace Illuminate\Contracts\Redis\Connections; + +use Closure; + +interface Connection +{ + /** + * Subscribe to a set of given channels for messages. + * + * @param array|string $channels + * @param \Closure $callback + * @return void + */ + public function subscribe($channels, Closure $callback); + + /** + * Subscribe to a set of given channels with wildcards. + * + * @param array|string $channels + * @param \Closure $callback + * @return void + */ + public function psubscribe($channels, Closure $callback); + + /** + * Run a command against the Redis database. + * + * @param string $method + * @param array $parameters + * @return mixed + */ + public function command($method, array $parameters = []); +} \ No newline at end of file
false
Other
laravel
framework
951d42f54af7bf84897d3d2907e8476a4d2a26db.json
Add PR template (#23846) (#24128) - this pr is cherry-picked from the https://github.com/laravel/framework/pull/23846 since the default branch is 5.6 * add simple PR template * update copy (cherry picked from commit 8124f9b)
.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,5 @@ +<!-- +Pull Requests without a descriptive title, thorough description, or tests will be closed. + +Please include the benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc. +-->
false
Other
laravel
framework
2b30f092f0732cfb9e127fa4c1382ea170fb9cad.json
Add php doc to facade (#24130)
src/Illuminate/Support/Facades/Schema.php
@@ -7,6 +7,7 @@ * @method static \Illuminate\Database\Schema\Builder drop(string $table) * @method static \Illuminate\Database\Schema\Builder dropIfExists(string $table) * @method static \Illuminate\Database\Schema\Builder table(string $table, \Closure $callback) + * @method static void defaultStringLength(int $length) * * @see \Illuminate\Database\Schema\Builder */
false
Other
laravel
framework
97833b3105f71567867c6360878b568b0c063afa.json
Apply fixes from StyleCI (#24097)
src/Illuminate/Database/Eloquent/Relations/HasManyThrough.php
@@ -424,7 +424,7 @@ protected function shouldSelect(array $columns = ['*']) */ public function chunk($count, callable $callback) { - return $this->prepareQueryBuilder()->chunk($count,$callback); + return $this->prepareQueryBuilder()->chunk($count, $callback); } /**
true
Other
laravel
framework
97833b3105f71567867c6360878b568b0c063afa.json
Apply fixes from StyleCI (#24097)
tests/Database/DatabaseEloquentHasManyThroughIntegrationTest.php
@@ -180,12 +180,13 @@ public function testOnlyProperColumnsAreSelectedIfProvided() ], array_keys($post->getAttributes())); } - public function testChunkReturnsCorrectModels(){ + public function testChunkReturnsCorrectModels() + { $this->seedData(); $this->seedDataExtended(); $country = HasManyThroughTestCountry::find(2); - $country->posts()->chunk(10,function($postsChunk){ + $country->posts()->chunk(10, function ($postsChunk) { $post = $postsChunk->first(); $this->assertEquals([ 'id', @@ -195,16 +196,17 @@ public function testChunkReturnsCorrectModels(){ 'email', 'created_at', 'updated_at', - 'country_id'],array_keys($post->getAttributes())); - + 'country_id', ], array_keys($post->getAttributes())); }); } - public function testEachReturnsCorrectModels(){ + + public function testEachReturnsCorrectModels() + { $this->seedData(); $this->seedDataExtended(); $country = HasManyThroughTestCountry::find(2); - $country->posts()->each(function($post){ + $country->posts()->each(function ($post) { $this->assertEquals([ 'id', 'user_id', @@ -213,10 +215,10 @@ public function testEachReturnsCorrectModels(){ 'email', 'created_at', 'updated_at', - 'country_id'],array_keys($post->getAttributes())); - + 'country_id', ], array_keys($post->getAttributes())); }); } + public function testIntermediateSoftDeletesAreIgnored() { $this->seedData(); @@ -250,25 +252,25 @@ protected function seedData() ['title' => 'Another title', 'body' => 'Another body', 'email' => 'taylorotwell@gmail.com'], ]); } - protected function seedDataExtended(){ + + protected function seedDataExtended() + { $country = HasManyThroughTestCountry::create(['id' => 2, 'name' => 'United Kingdom', 'shortname' => 'uk']); $country->users()->create(['id' => 2, 'email' => 'example1@gmail.com', 'country_short' => 'uk']) ->posts()->createMany([ ['title' => 'Example1 title1', 'body' => 'Example1 body1', 'email' => 'example1post1@gmail.com'], - ['title' => 'Example1 title2', 'body' => 'Example1 body2', 'email' => 'example1post2@gmail.com'] + ['title' => 'Example1 title2', 'body' => 'Example1 body2', 'email' => 'example1post2@gmail.com'], ]); $country->users()->create(['id' => 3, 'email' => 'example2@gmail.com', 'country_short' => 'uk']) ->posts()->createMany([ ['title' => 'Example2 title1', 'body' => 'Example2 body1', 'email' => 'example2post1@gmail.com'], - ['title' => 'Example2 title2', 'body' => 'Example2 body2', 'email' => 'example2post2@gmail.com'] + ['title' => 'Example2 title2', 'body' => 'Example2 body2', 'email' => 'example2post2@gmail.com'], ]); $country->users()->create(['id' => 4, 'email' => 'example3@gmail.com', 'country_short' => 'uk']) ->posts()->createMany([ ['title' => 'Example3 title1', 'body' => 'Example3 body1', 'email' => 'example3post1@gmail.com'], - ['title' => 'Example3 title2', 'body' => 'Example3 body2', 'email' => 'example3post2@gmail.com'] + ['title' => 'Example3 title2', 'body' => 'Example3 body2', 'email' => 'example3post2@gmail.com'], ]); - - } /**
true
Other
laravel
framework
5e91cc382c12654dca7174264860d51aad0fed38.json
remove brittle test for now
tests/Integration/Http/ThrottleRequestsWithRedisTest.php
@@ -50,18 +50,16 @@ public function test_lock_opens_immediately_after_decay() $this->assertEquals(2, $response->headers->get('X-RateLimit-Limit')); $this->assertEquals(0, $response->headers->get('X-RateLimit-Remaining')); - Carbon::setTestNow( - $now->addSeconds(58) - ); + Carbon::setTestNow($finish = $now->addSeconds(58)); try { $this->withoutExceptionHandling()->get('/'); } catch (Throwable $e) { $this->assertEquals(429, $e->getStatusCode()); $this->assertEquals(2, $e->getHeaders()['X-RateLimit-Limit']); $this->assertEquals(0, $e->getHeaders()['X-RateLimit-Remaining']); - $this->assertTrue(in_array($e->getHeaders()['Retry-After'], [2, 3])); - $this->assertTrue(in_array($e->getHeaders()['X-RateLimit-Reset'], [Carbon::now()->getTimestamp() + 2, Carbon::now()->getTimestamp() + 3])); + // $this->assertTrue(in_array($e->getHeaders()['Retry-After'], [2, 3])); + // $this->assertTrue(in_array($e->getHeaders()['X-RateLimit-Reset'], [$finish->getTimestamp() + 2, $finish->getTimestamp() + 3])); } }); }
false
Other
laravel
framework
47580bff887078d514bc45ce20c8c1677820cf27.json
Restrict comparison against hardcoded integers
src/Illuminate/Validation/Concerns/ValidatesAttributes.php
@@ -458,7 +458,7 @@ public function validateGt($attribute, $value, $parameters) $comparedToValue = $this->getValue($parameters[0]); - if (is_null($comparedToValue) && is_numeric($parameters[0])) { + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { return $this->getSize($attribute, $value) > $parameters[0]; } @@ -481,7 +481,7 @@ public function validateLt($attribute, $value, $parameters) $comparedToValue = $this->getValue($parameters[0]); - if (is_null($comparedToValue) && is_numeric($parameters[0])) { + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { return $this->getSize($attribute, $value) < $parameters[0]; } @@ -504,7 +504,7 @@ public function validateGte($attribute, $value, $parameters) $comparedToValue = $this->getValue($parameters[0]); - if (is_null($comparedToValue) && is_numeric($parameters[0])) { + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { return $this->getSize($attribute, $value) >= $parameters[0]; } @@ -527,7 +527,7 @@ public function validateLte($attribute, $value, $parameters) $comparedToValue = $this->getValue($parameters[0]); - if (is_null($comparedToValue) && is_numeric($parameters[0])) { + if (is_null($comparedToValue) && (is_numeric($value) && is_numeric($parameters[0]))) { return $this->getSize($attribute, $value) <= $parameters[0]; }
false
Other
laravel
framework
ba6535590535a089473a78509d6814cf185682ca.json
Build http queries with RFC3986
src/Illuminate/Http/Request.php
@@ -124,8 +124,8 @@ public function fullUrlWithQuery(array $query) $question = $this->getBaseUrl().$this->getPathInfo() == '/' ? '/?' : '?'; return count($this->query()) > 0 - ? $this->url().$question.http_build_query(array_merge($this->query(), $query)) - : $this->fullUrl().$question.http_build_query($query); + ? $this->url().$question.http_build_query(array_merge($this->query(), $query), null, '&', PHP_QUERY_RFC3986) + : $this->fullUrl().$question.http_build_query($query, null, '&', PHP_QUERY_RFC3986); } /**
true
Other
laravel
framework
ba6535590535a089473a78509d6814cf185682ca.json
Build http queries with RFC3986
src/Illuminate/Pagination/AbstractPaginator.php
@@ -156,7 +156,7 @@ public function url($page) return $this->path .(Str::contains($this->path, '?') ? '&' : '?') - .http_build_query($parameters, '', '&') + .http_build_query($parameters, null, '&', PHP_QUERY_RFC3986) .$this->buildFragment(); }
true
Other
laravel
framework
ba6535590535a089473a78509d6814cf185682ca.json
Build http queries with RFC3986
src/Illuminate/Redis/Connectors/PhpRedisConnector.php
@@ -51,7 +51,7 @@ protected function buildClusterConnectionString(array $server) { return $server['host'].':'.$server['port'].'?'.http_build_query(Arr::only($server, [ 'database', 'password', 'prefix', 'read_timeout', - ])); + ]), null, '&', PHP_QUERY_RFC3986); } /**
true
Other
laravel
framework
ba6535590535a089473a78509d6814cf185682ca.json
Build http queries with RFC3986
src/Illuminate/Routing/RouteUrlGenerator.php
@@ -255,7 +255,10 @@ protected function getRouteQueryString(array $parameters) } $query = http_build_query( - $keyed = $this->getStringParameters($parameters) + $keyed = $this->getStringParameters($parameters), + null, + '&', + PHP_QUERY_RFC3986 ); // Lastly, if there are still parameters remaining, we will fetch the numeric
true
Other
laravel
framework
ba6535590535a089473a78509d6814cf185682ca.json
Build http queries with RFC3986
src/Illuminate/Routing/UrlGenerator.php
@@ -340,7 +340,10 @@ public function temporarySignedRoute($name, $expiration, $parameters = []) public function hasValidSignature(Request $request) { $original = rtrim($request->url().'?'.http_build_query( - Arr::except($request->query(), 'signature') + Arr::except($request->query(), 'signature'), + null, + '&', + PHP_QUERY_RFC3986 ), '?'); $expires = Arr::get($request->query(), 'expires');
true
Other
laravel
framework
ba6535590535a089473a78509d6814cf185682ca.json
Build http queries with RFC3986
tests/Http/HttpRequestTest.php
@@ -141,6 +141,9 @@ public function testFullUrlMethod() $request = Request::create('http://foo.com/foo/bar/?name=taylor', 'GET'); $this->assertEquals('http://foo.com/foo/bar?name=graham', $request->fullUrlWithQuery(['name' => 'graham'])); + + $request = Request::create('https://foo.com', 'GET'); + $this->assertEquals('https://foo.com?key=value%20with%20spaces', $request->fullUrlWithQuery(['key' => 'value with spaces'])); } public function testIsMethod()
true
Other
laravel
framework
ba6535590535a089473a78509d6814cf185682ca.json
Build http queries with RFC3986
tests/Pagination/LengthAwarePaginatorTest.php
@@ -83,4 +83,13 @@ public function testLengthAwarePaginatorCanGenerateUrlsWithoutTrailingSlashes() $this->assertEquals('http://website.com/test?foo=1', $this->p->url($this->p->currentPage() - 2)); } + + public function testLengthAwarePaginatorCorrectlyGenerateUrlsWithQueryAndSpaces() + { + $this->p->setPath('http://website.com?key=value%20with%20spaces'); + $this->p->setPageName('foo'); + + $this->assertEquals('http://website.com?key=value%20with%20spaces&foo=2', + $this->p->url($this->p->currentPage())); + } }
true
Other
laravel
framework
4a49ba5f2e86d29f8f07dc65640460822ee98bd0.json
add tests for Support\Optional
tests/Support/SupportOptionalTest.php
@@ -0,0 +1,52 @@ +<?php + +namespace Illuminate\Tests\Support; + +use PHPUnit\Framework\TestCase; +use Illuminate\Support\Optional; + +class SupportOptionalTest extends TestCase +{ + public function testGetExistItemOnObject() + { + $expected = 'test'; + + $targetObj = new \stdClass; + $targetObj->item = $expected; + + $optional = new Optional($targetObj); + + $this->assertEquals($expected, $optional->item); + } + + public function testGetNotExistItemOnObject() + { + $targetObj = new \stdClass; + + $optional = new Optional($targetObj); + + $this->assertNull($optional->item); + } + + public function testGetExistItemOnArray() + { + $expected = 'test'; + + $targetArr = [ + 'item' => $expected, + ]; + + $optional = new Optional($targetArr); + + $this->assertEquals($expected, $optional['item']); + } + + public function testGetNotExistItemOnArray() + { + $targetObj = []; + + $optional = new Optional($targetObj); + + $this->assertNull($optional['item']); + } +}
false
Other
laravel
framework
4861b82bd1395fdcddd2fab1ae728c05ba2aba55.json
Apply fixes from StyleCI (#24008)
src/Illuminate/Foundation/Providers/FoundationServiceProvider.php
@@ -2,7 +2,6 @@ namespace Illuminate\Foundation\Providers; -use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Support\Facades\URL; use Illuminate\Support\AggregateServiceProvider;
false
Other
laravel
framework
91aefbe8b265954379537dcb946e3450e8f52832.json
Add a named route for POST password/reset (#23958) The reset.stub is using the GET named route (password.request) for the POST password/reset request (changed in #17718). Incorrectly using a named route from another route is confusing and could lead to unexpected results.
src/Illuminate/Auth/Console/stubs/make/views/auth/passwords/reset.stub
@@ -8,7 +8,7 @@ <div class="card-header">{{ __('Reset Password') }}</div> <div class="card-body"> - <form method="POST" action="{{ route('password.request') }}"> + <form method="POST" action="{{ route('password.update') }}"> @csrf <input type="hidden" name="token" value="{{ $token }}">
true
Other
laravel
framework
91aefbe8b265954379537dcb946e3450e8f52832.json
Add a named route for POST password/reset (#23958) The reset.stub is using the GET named route (password.request) for the POST password/reset request (changed in #17718). Incorrectly using a named route from another route is confusing and could lead to unexpected results.
src/Illuminate/Routing/Router.php
@@ -1135,7 +1135,7 @@ public function auth() $this->get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request'); $this->post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email'); $this->get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset'); - $this->post('password/reset', 'Auth\ResetPasswordController@reset'); + $this->post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update'); } /**
true
Other
laravel
framework
23721ac05acfd1dbb169d67b71ec63ea6318258e.json
fix response code
src/Illuminate/Foundation/Auth/ThrottlesLogins.php
@@ -52,7 +52,7 @@ protected function sendLockoutResponse(Request $request) throw ValidationException::withMessages([ $this->username() => [Lang::get('auth.throttle', ['seconds' => $seconds])], - ])->status(423); + ])->status(429); } /**
false
Other
laravel
framework
d7cf66e4fb37a0120bf6a31712e5dd686506883e.json
Improve pagination accessibility (#23962) - Add `role="navigation"` An alternative is to wrap `<nav>` around, but that will shift the HTML structure - Add `aria-disabled="true"` for disabled items - Label previous/next page items with `aria-label` - Hide decoration arrows from screen-readers with `aria-hidden="true"` - Mark current page with `aria-current="page"`
src/Illuminate/Pagination/resources/views/bootstrap-4.blade.php
@@ -1,24 +1,28 @@ @if ($paginator->hasPages()) - <ul class="pagination"> + <ul class="pagination" role="navigation"> {{-- Previous Page Link --}} @if ($paginator->onFirstPage()) - <li class="page-item disabled"><span class="page-link">&lsaquo;</span></li> + <li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.previous')"> + <span class="page-link" aria-hidden="true">&lsaquo;</span> + </li> @else - <li class="page-item"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">&lsaquo;</a></li> + <li class="page-item"> + <a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev" aria-label="@lang('pagination.previous')">&lsaquo;</a> + </li> @endif {{-- Pagination Elements --}} @foreach ($elements as $element) {{-- "Three Dots" Separator --}} @if (is_string($element)) - <li class="page-item disabled"><span class="page-link">{{ $element }}</span></li> + <li class="page-item disabled" aria-disabled="true"><span class="page-link">{{ $element }}</span></li> @endif {{-- Array Of Links --}} @if (is_array($element)) @foreach ($element as $page => $url) @if ($page == $paginator->currentPage()) - <li class="page-item active"><span class="page-link">{{ $page }}</span></li> + <li class="page-item active" aria-current="page"><span class="page-link">{{ $page }}</span></li> @else <li class="page-item"><a class="page-link" href="{{ $url }}">{{ $page }}</a></li> @endif @@ -28,9 +32,13 @@ {{-- Next Page Link --}} @if ($paginator->hasMorePages()) - <li class="page-item"><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">&rsaquo;</a></li> + <li class="page-item"> + <a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next" aria-label="@lang('pagination.next')">&rsaquo;</a> + </li> @else - <li class="page-item disabled"><span class="page-link">&rsaquo;</span></li> + <li class="page-item disabled" aria-disabled="true" aria-label="@lang('pagination.next')"> + <span class="page-link" aria-hidden="true">&rsaquo;</span> + </li> @endif </ul> @endif
true
Other
laravel
framework
d7cf66e4fb37a0120bf6a31712e5dd686506883e.json
Improve pagination accessibility (#23962) - Add `role="navigation"` An alternative is to wrap `<nav>` around, but that will shift the HTML structure - Add `aria-disabled="true"` for disabled items - Label previous/next page items with `aria-label` - Hide decoration arrows from screen-readers with `aria-hidden="true"` - Mark current page with `aria-current="page"`
src/Illuminate/Pagination/resources/views/default.blade.php
@@ -1,24 +1,28 @@ @if ($paginator->hasPages()) - <ul class="pagination"> + <ul class="pagination" role="navigation"> {{-- Previous Page Link --}} @if ($paginator->onFirstPage()) - <li class="disabled"><span>&lsaquo;</span></li> + <li class="disabled" aria-disabled="true" aria-label="@lang('pagination.previous')"> + <span aria-hidden="true">&lsaquo;</span> + </li> @else - <li><a href="{{ $paginator->previousPageUrl() }}" rel="prev">&lsaquo;</a></li> + <li> + <a href="{{ $paginator->previousPageUrl() }}" rel="prev" aria-label="@lang('pagination.previous')">&lsaquo;</a> + </li> @endif {{-- Pagination Elements --}} @foreach ($elements as $element) {{-- "Three Dots" Separator --}} @if (is_string($element)) - <li class="disabled"><span>{{ $element }}</span></li> + <li class="disabled" aria-disabled="true"><span>{{ $element }}</span></li> @endif {{-- Array Of Links --}} @if (is_array($element)) @foreach ($element as $page => $url) @if ($page == $paginator->currentPage()) - <li class="active"><span>{{ $page }}</span></li> + <li class="active" aria-current="page"><span>{{ $page }}</span></li> @else <li><a href="{{ $url }}">{{ $page }}</a></li> @endif @@ -28,9 +32,13 @@ {{-- Next Page Link --}} @if ($paginator->hasMorePages()) - <li><a href="{{ $paginator->nextPageUrl() }}" rel="next">&rsaquo;</a></li> + <li> + <a href="{{ $paginator->nextPageUrl() }}" rel="next" aria-label="@lang('pagination.next')">&rsaquo;</a> + </li> @else - <li class="disabled"><span>&rsaquo;</span></li> + <li class="disabled" aria-disabled="true" aria-label="@lang('pagination.next')"> + <span aria-hidden="true">&rsaquo;</span> + </li> @endif </ul> @endif
true
Other
laravel
framework
d7cf66e4fb37a0120bf6a31712e5dd686506883e.json
Improve pagination accessibility (#23962) - Add `role="navigation"` An alternative is to wrap `<nav>` around, but that will shift the HTML structure - Add `aria-disabled="true"` for disabled items - Label previous/next page items with `aria-label` - Hide decoration arrows from screen-readers with `aria-hidden="true"` - Mark current page with `aria-current="page"`
src/Illuminate/Pagination/resources/views/semantic-ui.blade.php
@@ -1,24 +1,24 @@ @if ($paginator->hasPages()) - <div class="ui pagination menu"> + <div class="ui pagination menu" role="navigation"> {{-- Previous Page Link --}} @if ($paginator->onFirstPage()) - <a class="icon item disabled"> <i class="left chevron icon"></i> </a> + <a class="icon item disabled" aria-disabled="true" aria-label="@lang('pagination.previous')"> <i class="left chevron icon"></i> </a> @else - <a class="icon item" href="{{ $paginator->previousPageUrl() }}" rel="prev"> <i class="left chevron icon"></i> </a> + <a class="icon item" href="{{ $paginator->previousPageUrl() }}" rel="prev" aria-label="@lang('pagination.previous')"> <i class="left chevron icon"></i> </a> @endif {{-- Pagination Elements --}} @foreach ($elements as $element) {{-- "Three Dots" Separator --}} @if (is_string($element)) - <a class="icon item disabled">{{ $element }}</a> + <a class="icon item disabled" aria-disabled="true">{{ $element }}</a> @endif {{-- Array Of Links --}} @if (is_array($element)) @foreach ($element as $page => $url) @if ($page == $paginator->currentPage()) - <a class="item active" href="{{ $url }}">{{ $page }}</a> + <a class="item active" href="{{ $url }}" aria-current="page">{{ $page }}</a> @else <a class="item" href="{{ $url }}">{{ $page }}</a> @endif @@ -28,9 +28,9 @@ {{-- Next Page Link --}} @if ($paginator->hasMorePages()) - <a class="icon item" href="{{ $paginator->nextPageUrl() }}" rel="next"> <i class="right chevron icon"></i> </a> + <a class="icon item" href="{{ $paginator->nextPageUrl() }}" rel="next" aria-label="@lang('pagination.next')"> <i class="right chevron icon"></i> </a> @else - <a class="icon item disabled"> <i class="right chevron icon"></i> </a> + <a class="icon item disabled" aria-disabled="true" aria-label="@lang('pagination.next')"> <i class="right chevron icon"></i> </a> @endif </div> @endif
true
Other
laravel
framework
d7cf66e4fb37a0120bf6a31712e5dd686506883e.json
Improve pagination accessibility (#23962) - Add `role="navigation"` An alternative is to wrap `<nav>` around, but that will shift the HTML structure - Add `aria-disabled="true"` for disabled items - Label previous/next page items with `aria-label` - Hide decoration arrows from screen-readers with `aria-hidden="true"` - Mark current page with `aria-current="page"`
src/Illuminate/Pagination/resources/views/simple-bootstrap-4.blade.php
@@ -1,17 +1,25 @@ @if ($paginator->hasPages()) - <ul class="pagination"> + <ul class="pagination" role="navigation"> {{-- Previous Page Link --}} @if ($paginator->onFirstPage()) - <li class="page-item disabled"><span class="page-link">@lang('pagination.previous')</span></li> + <li class="page-item disabled" aria-disabled="true"> + <span class="page-link">@lang('pagination.previous')</span> + </li> @else - <li class="page-item"><a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">@lang('pagination.previous')</a></li> + <li class="page-item"> + <a class="page-link" href="{{ $paginator->previousPageUrl() }}" rel="prev">@lang('pagination.previous')</a> + </li> @endif {{-- Next Page Link --}} @if ($paginator->hasMorePages()) - <li class="page-item"><a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">@lang('pagination.next')</a></li> + <li class="page-item"> + <a class="page-link" href="{{ $paginator->nextPageUrl() }}" rel="next">@lang('pagination.next')</a> + </li> @else - <li class="page-item disabled"><span class="page-link">@lang('pagination.next')</span></li> + <li class="page-item disabled" aria-disabled="true"> + <span class="page-link">@lang('pagination.next')</span> + </li> @endif </ul> @endif
true
Other
laravel
framework
d7cf66e4fb37a0120bf6a31712e5dd686506883e.json
Improve pagination accessibility (#23962) - Add `role="navigation"` An alternative is to wrap `<nav>` around, but that will shift the HTML structure - Add `aria-disabled="true"` for disabled items - Label previous/next page items with `aria-label` - Hide decoration arrows from screen-readers with `aria-hidden="true"` - Mark current page with `aria-current="page"`
src/Illuminate/Pagination/resources/views/simple-default.blade.php
@@ -1,8 +1,8 @@ @if ($paginator->hasPages()) - <ul class="pagination"> + <ul class="pagination" role="navigation"> {{-- Previous Page Link --}} @if ($paginator->onFirstPage()) - <li class="disabled"><span>@lang('pagination.previous')</span></li> + <li class="disabled" aria-disabled="true"><span>@lang('pagination.previous')</span></li> @else <li><a href="{{ $paginator->previousPageUrl() }}" rel="prev">@lang('pagination.previous')</a></li> @endif @@ -11,7 +11,7 @@ @if ($paginator->hasMorePages()) <li><a href="{{ $paginator->nextPageUrl() }}" rel="next">@lang('pagination.next')</a></li> @else - <li class="disabled"><span>@lang('pagination.next')</span></li> + <li class="disabled" aria-disabled="true"><span>@lang('pagination.next')</span></li> @endif </ul> @endif
true
Other
laravel
framework
0d18dc3d41d3a3dc48f5bceabed1dbe45d9597ac.json
Apply fixes from StyleCI (#24001)
tests/Integration/Console/ConsoleApplicationTest.php
@@ -33,7 +33,7 @@ public function test_artisan_call_using_command_class() $this->assertEquals($exitCode, 0); } - /** + /* * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException */ // public function test_artisan_call_invalid_command_name()
false
Other
laravel
framework
c9246fb5db7bccae0039a64040587cd70030a5d3.json
remove broken test
src/Illuminate/Database/Eloquent/Relations/Pivot.php
@@ -84,6 +84,8 @@ public static function fromRawAttributes(Model $parent, $attributes, $table, $ex $instance->setRawAttributes($attributes, true); + $instance->timestamps = $instance->hasTimestampAttributes(); + return $instance; }
true
Other
laravel
framework
c9246fb5db7bccae0039a64040587cd70030a5d3.json
remove broken test
tests/Database/DatabaseEloquentPivotTest.php
@@ -89,6 +89,14 @@ public function testTimestampPropertyIsSetIfCreatedAtInAttributes() $this->assertFalse($pivot->timestamps); } + public function testTimestampPropertyIsTrueWhenCreatingFromRawAttributes() + { + $parent = m::mock('Illuminate\Database\Eloquent\Model[getConnectionName,getDates]'); + $parent->shouldReceive('getConnectionName')->andReturn('connection'); + $pivot = Pivot::fromRawAttributes($parent, ['foo' => 'bar', 'created_at' => 'foo'], 'table'); + $this->assertTrue($pivot->timestamps); + } + public function testKeysCanBeSetProperly() { $parent = m::mock('Illuminate\Database\Eloquent\Model[getConnectionName]');
true
Other
laravel
framework
c9246fb5db7bccae0039a64040587cd70030a5d3.json
remove broken test
tests/Filesystem/FilesystemAdapterTest.php
@@ -38,7 +38,7 @@ public function testResponse() $this->assertInstanceOf(StreamedResponse::class, $response); $this->assertEquals('Hello World', $content); - $this->assertEquals('inline; filename="file.txt"', $response->headers->get('content-disposition')); + $this->assertEquals('inline; filename=file.txt', $response->headers->get('content-disposition')); } public function testDownload() @@ -47,7 +47,7 @@ public function testDownload() $files = new FilesystemAdapter($this->filesystem); $response = $files->download('file.txt', 'hello.txt'); $this->assertInstanceOf(StreamedResponse::class, $response); - $this->assertEquals('attachment; filename="hello.txt"', $response->headers->get('content-disposition')); + $this->assertEquals('attachment; filename=hello.txt', $response->headers->get('content-disposition')); } public function testExists()
true
Other
laravel
framework
c9246fb5db7bccae0039a64040587cd70030a5d3.json
remove broken test
tests/Integration/Console/ConsoleApplicationTest.php
@@ -36,10 +36,10 @@ public function test_artisan_call_using_command_class() /** * @expectedException \Symfony\Component\Console\Exception\CommandNotFoundException */ - public function test_artisan_call_invalid_command_name() - { - $this->artisan('foo:bars'); - } + // public function test_artisan_call_invalid_command_name() + // { + // $this->artisan('foo:bars'); + // } } class FooCommandStub extends Command
true
Other
laravel
framework
b41c9e1153e8bcb39718bae76d8d8384e59a94ce.json
add second assertEquals
tests/Support/SupportCollectionTest.php
@@ -2056,9 +2056,11 @@ public function testGettingMinItemsFromCollection() $c = new Collection([['foo' => 10], ['foo' => 20]]); $this->assertEquals(10, $c->min('foo')); + $this->assertEquals(10, $c->min->foo); $c = new Collection([['foo' => 10], ['foo' => 20], ['foo' => null]]); $this->assertEquals(10, $c->min('foo')); + $this->assertEquals(10, $c->min->foo); $c = new Collection([1, 2, 3, 4, 5]); $this->assertEquals(1, $c->min());
false
Other
laravel
framework
ee051fb44425a5cbf363f640b6dd33f492d90940.json
Highlight the discovered package name (#23863)
src/Illuminate/Foundation/Console/PackageDiscoverCommand.php
@@ -32,7 +32,7 @@ public function handle(PackageManifest $manifest) $manifest->build(); foreach (array_keys($manifest->manifest) as $package) { - $this->line("<info>Discovered Package:</info> {$package}"); + $this->line("Discovered Package: <info>{$package}</info>"); } $this->info('Package manifest generated successfully.');
false
Other
laravel
framework
c562b63b7fdd7ba438b0c0be1bfe6a891b432d80.json
Add oxford comma (#23849)
.github/PULL_REQUEST_TEMPLATE.md
@@ -1,5 +1,5 @@ <!-- -Pull Requests without a descriptive title, thorough description or tests will be closed. +Pull Requests without a descriptive title, thorough description, or tests will be closed. Please include the benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc. -->
false
Other
laravel
framework
8124f9b8fafb6bd5e7c834c789709c01fedd39f5.json
Add PR template (#23846) * add simple PR template * update copy
.github/PULL_REQUEST_TEMPLATE.md
@@ -0,0 +1,5 @@ +<!-- +Pull Requests without a descriptive title, thorough description or tests will be closed. + +Please include the benefit to end users; the reasons it does not break any existing features; how it makes building web applications easier, etc. +-->
false
Other
laravel
framework
39cbd0066c3382fca83a06c34c213266cfe34e35.json
Add displayable value to required_unless
src/Illuminate/Validation/Concerns/ReplacesAttributes.php
@@ -277,9 +277,14 @@ protected function replaceRequiredIf($message, $attribute, $rule, $parameters) */ protected function replaceRequiredUnless($message, $attribute, $rule, $parameters) { - $other = $this->getDisplayableAttribute(array_shift($parameters)); + $other = $this->getDisplayableAttribute($parameters[0]); - return str_replace([':other', ':values'], [$other, implode(', ', $parameters)], $message); + $values = []; + foreach (array_slice($parameters, 1) as $value) { + $values[] = $this->getDisplayableValue($parameters[0], $value); + } + + return str_replace([':other', ':values'], [$other, implode(', ', $values)], $message); } /**
true
Other
laravel
framework
39cbd0066c3382fca83a06c34c213266cfe34e35.json
Add displayable value to required_unless
tests/Validation/ValidationValidatorTest.php
@@ -403,6 +403,15 @@ public function testDisplayableValuesAreReplaced() $v->messages()->setFormat(':message'); $this->assertEquals('The bar field is required when color is red.', $v->messages()->first('bar')); + //required_unless:foo,bar + $trans = $this->getIlluminateArrayTranslator(); + $trans->addLines(['validation.required_unless' => 'The :attribute field is required unless :other is in :values.'], 'en'); + $trans->addLines(['validation.values.color.1' => 'red'], 'en'); + $v = new Validator($trans, ['color' => '2', 'bar' => ''], ['bar' => 'RequiredUnless:color,1']); + $this->assertFalse($v->passes()); + $v->messages()->setFormat(':message'); + $this->assertEquals('The bar field is required unless color is in red.', $v->messages()->first('bar')); + //in:foo,bar,... $trans = $this->getIlluminateArrayTranslator(); $trans->addLines(['validation.in' => ':attribute must be included in :values.'], 'en');
true
Other
laravel
framework
f4f663025fa0246a22d8d4026e54344839deb317.json
add test for prepend directive (#23806)
tests/View/Blade/BladePrependTest.php
@@ -0,0 +1,18 @@ +<?php + +namespace Illuminate\Tests\View\Blade; + +class BladePrependTest extends AbstractBladeTestCase +{ + public function testPrependIsCompiled() + { + $string = '@prepend(\'foo\') +bar +@endprepend'; + $expected = '<?php $__env->startPrepend(\'foo\'); ?> +bar +<?php $__env->stopPrepend(); ?>'; + + $this->assertEquals($expected, $this->compiler->compileString($string)); + } +}
false
Other
laravel
framework
28e53f23a76206fb130e9a54eb95aa3f010e79c9.json
check iv length
src/Illuminate/Encryption/Encrypter.php
@@ -206,9 +206,8 @@ protected function getJsonPayload($payload) */ protected function validPayload($payload) { - return is_array($payload) && isset( - $payload['iv'], $payload['value'], $payload['mac'] - ); + return is_array($payload) && isset($payload['iv'], $payload['value'], $payload['mac']) && + strlen(base64_decode($payload['iv'], true)) === openssl_cipher_iv_length($this->cipher); } /**
false
Other
laravel
framework
886d261df0854426b4662b7ed5db6a1c575a4279.json
check iv length
src/Illuminate/Encryption/Encrypter.php
@@ -206,9 +206,8 @@ protected function getJsonPayload($payload) */ protected function validPayload($payload) { - return is_array($payload) && isset( - $payload['iv'], $payload['value'], $payload['mac'] - ); + return is_array($payload) && isset($payload['iv'], $payload['value'], $payload['mac']) && + strlen(base64_decode($payload['iv'], true)) === openssl_cipher_iv_length($this->cipher); } /**
true
Other
laravel
framework
886d261df0854426b4662b7ed5db6a1c575a4279.json
check iv length
tests/Encryption/EncrypterTest.php
@@ -102,4 +102,19 @@ public function testExceptionThrownWithDifferentKey() $b = new Encrypter(str_repeat('b', 16)); $b->decrypt($a->encrypt('baz')); } + + /** + * @expectedException \Illuminate\Contracts\Encryption\DecryptException + * @expectedExceptionMessage The payload is invalid. + */ + public function testExceptionThrownWhenIvIsTooLong() + { + $e = new Encrypter(str_repeat('a', 16)); + $payload = $e->encrypt('foo'); + $data = json_decode(base64_decode($payload), true); + $data['iv'] .= $data['value'][0]; + $data['value'] = substr($data['value'], 1); + $modified_payload = base64_encode(json_encode($data)); + $e->decrypt($modified_payload); + } }
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/Auth/AuthAccessGateTest.php
@@ -9,7 +9,7 @@ use Illuminate\Auth\Access\Response; use Illuminate\Auth\Access\HandlesAuthorization; -class GateTest extends TestCase +class AuthAccessGateTest extends TestCase { /** * @expectedException \InvalidArgumentException
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/Foundation/Testing/Concerns/MakesHttpRequestsTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Foundation\Http\Middleware; +namespace Illuminate\Tests\Foundation\Testing\Concerns; use Orchestra\Testbench\TestCase;
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/Foundation/Testing/Constraints/SeeInOrderTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Foundation\Constraints; +namespace Illuminate\Tests\Foundation\Testing\Constraints; use PHPUnit\Framework\TestCase; use Illuminate\Tests\Foundation\FoundationTestResponseTest;
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/Integration/Foundation/FoundationHelpersTest.php
@@ -8,7 +8,7 @@ /** * @group integration */ -class HelpersTest extends TestCase +class FoundationHelpersTest extends TestCase { public function test_rescue() {
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/Integration/Mail/SendingMailWithLocaleTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Integration\Mail\SendingMailWithLocale; +namespace Illuminate\Tests\Integration\Mail; use Mockery; use Illuminate\Mail\Mailable;
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/Integration/Routing/FluentRoutingTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Integration\Routing\FluentRoutingTest; +namespace Illuminate\Tests\Integration\Routing; use Orchestra\Testbench\TestCase; use Illuminate\Support\Facades\Route;
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/Support/SupportTestingMailFakeTest.php
@@ -9,7 +9,7 @@ use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\Constraint\ExceptionMessage; -class MailFakeTest extends TestCase +class SupportTestingMailFakeTest extends TestCase { protected function setUp() {
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/Support/SupportTestingNotificationFakeTest.php
@@ -9,7 +9,7 @@ use PHPUnit\Framework\Constraint\ExceptionMessage; use Illuminate\Support\Testing\Fakes\NotificationFake; -class NotificationFakeTest extends TestCase +class SupportTestingNotificationFakeTest extends TestCase { protected function setUp() {
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/Support/SupportTestingQueueFakeTest.php
@@ -9,7 +9,7 @@ use PHPUnit\Framework\ExpectationFailedException; use PHPUnit\Framework\Constraint\ExceptionMessage; -class QueueFakeTest extends TestCase +class SupportTestingQueueFakeTest extends TestCase { protected function setUp() {
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/View/Blade/BladeElseAuthStatementsTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Blade; +namespace Illuminate\Tests\View\Blade; use Mockery as m; use PHPUnit\Framework\TestCase;
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/View/Blade/BladeElseGuestStatementsTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Blade; +namespace Illuminate\Tests\View\Blade; use Mockery as m; use PHPUnit\Framework\TestCase;
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/View/Blade/BladeIfAuthStatementsTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Blade; +namespace Illuminate\Tests\View\Blade; use Mockery as m; use PHPUnit\Framework\TestCase;
true
Other
laravel
framework
5fe2b0be1e06ef608ebc158fcad1956ba90b7f8c.json
Fix several autoloads in tests
tests/View/Blade/BladeIfGuestStatementsTest.php
@@ -1,6 +1,6 @@ <?php -namespace Illuminate\Tests\Blade; +namespace Illuminate\Tests\View\Blade; use Mockery as m; use PHPUnit\Framework\TestCase;
true
Other
laravel
framework
59a77e609756bec6d970e75a0500ae52e6fe685e.json
Fix undefined variable
src/Illuminate/Cache/RedisTaggedCache.php
@@ -55,7 +55,7 @@ public function increment($key, $value = 1) */ public function decrement($key, $value = 1) { - $this->pushStandardKeys($s->tags->getNamespace(), $key); + $this->pushStandardKeys($this->tags->getNamespace(), $key); parent::decrement($key, $value); }
false
Other
laravel
framework
0ebe9fede1566e4357b337da978bf5336b9c774e.json
add v5.6.14 release notes
CHANGELOG-5.6.md
@@ -1,5 +1,19 @@ # Release Notes for 5.6.x +## v5.6.14 (2018-03-28) + +### Added +- Added `SlackMessage::info()` method ([#23711](https://github.com/laravel/framework/pull/23711)) +- Added `SessionGuard::logoutOtherDevices()` method ([9c51e49](https://github.com/laravel/framework/commit/9c51e49a56ff15fc47ac1a6bf232c32c25d14fd0)) + +### Changed +- Replaced Blade's `or` operator with null-coalescing operator ([13f732e](https://github.com/laravel/framework/commit/13f732ed617e41608e4ae021efc9d13e43375a26)) + +### Fixed +- Get Blade compiler from engine resolver ([#23710](https://github.com/laravel/framework/pull/23710)) +- Default to an empty string when validating the URL signatures ([#23721](https://github.com/laravel/framework/pull/23721)) + + ## v5.6.13 (2018-03-26) ### Added
false
Other
laravel
framework
4ee07dd5135b060e49fc9e3da5a1e7aa828e76ef.json
Apply fixes from StyleCI (#23725)
src/Illuminate/Auth/Authenticatable.php
@@ -2,8 +2,6 @@ namespace Illuminate\Auth; -use Illuminate\Support\Facades\Hash; - trait Authenticatable { /**
true
Other
laravel
framework
4ee07dd5135b060e49fc9e3da5a1e7aa828e76ef.json
Apply fixes from StyleCI (#23725)
src/Illuminate/Auth/SessionGuard.php
@@ -550,7 +550,7 @@ public function logoutOtherDevices($password, $attribute = 'password') } return tap($this->user()->forceFill([ - $attribute => Hash::make($password) + $attribute => Hash::make($password), ]))->save(); }
true
Other
laravel
framework
274e81829b643fe4cf20b302ffaff5100c1a8f2b.json
Apply fixes from StyleCI (#23724)
src/Illuminate/Auth/Authenticatable.php
@@ -25,7 +25,7 @@ trait Authenticatable public function logoutOtherDevices($password, $attribute = 'password') { return tap($this->forceFill([ - $attribute => Hash::make($password) + $attribute => Hash::make($password), ]))->save(); }
false
Other
laravel
framework
200fdc60015987c67cea815c70241338aa2f5755.json
add logoutOtherDevices to trait
src/Illuminate/Auth/Authenticatable.php
@@ -2,6 +2,8 @@ namespace Illuminate\Auth; +use Illuminate\Support\Facades\Hash; + trait Authenticatable { /** @@ -11,6 +13,22 @@ trait Authenticatable */ protected $rememberTokenName = 'remember_token'; + /** + * Invalid other sessions for the current user. + * + * The application must be using the AuthenticateSession middleware. + * + * @param string $password + * @param string $attribute + * @return $this + */ + public function logoutOtherDevices($password, $attribute = 'password') + { + return tap($this->forceFill([ + $attribute => Hash::make($password) + ]))->save(); + } + /** * Get the name of the unique identifier for the user. *
false
Other
laravel
framework
0a56560863125853873997013b43f6ab1eeb5c2c.json
Improve nested rules in validated data (#23708)
src/Illuminate/Foundation/Http/FormRequest.php
@@ -2,6 +2,7 @@ namespace Illuminate\Foundation\Http; +use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Routing\Redirector; use Illuminate\Contracts\Container\Container; @@ -175,7 +176,7 @@ public function validated() $rules = $this->container->call([$this, 'rules']); return $this->only(collect($rules)->keys()->map(function ($rule) { - return explode('.', $rule)[0]; + return Str::contains($rule, '*') ? explode('.', $rule)[0] : $rule; })->unique()->toArray()); }
true
Other
laravel
framework
0a56560863125853873997013b43f6ab1eeb5c2c.json
Improve nested rules in validated data (#23708)
src/Illuminate/Foundation/Providers/FoundationServiceProvider.php
@@ -2,6 +2,7 @@ namespace Illuminate\Foundation\Providers; +use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Support\Facades\URL; use Illuminate\Support\AggregateServiceProvider; @@ -41,7 +42,7 @@ public function registerRequestValidation() validator()->validate($this->all(), $rules, ...$params); return $this->only(collect($rules)->keys()->map(function ($rule) { - return explode('.', $rule)[0]; + return Str::contains($rule, '*') ? explode('.', $rule)[0] : $rule; })->unique()->toArray()); }); }
true
Other
laravel
framework
0a56560863125853873997013b43f6ab1eeb5c2c.json
Improve nested rules in validated data (#23708)
src/Illuminate/Foundation/Validation/ValidatesRequests.php
@@ -2,6 +2,7 @@ namespace Illuminate\Foundation\Validation; +use Illuminate\Support\Str; use Illuminate\Http\Request; use Illuminate\Contracts\Validation\Factory; use Illuminate\Validation\ValidationException; @@ -57,7 +58,7 @@ public function validate(Request $request, array $rules, protected function extractInputFromRules(Request $request, array $rules) { return $request->only(collect($rules)->keys()->map(function ($rule) { - return explode('.', $rule)[0]; + return Str::contains($rule, '*') ? explode('.', $rule)[0] : $rule; })->unique()->toArray()); }
true
Other
laravel
framework
0a56560863125853873997013b43f6ab1eeb5c2c.json
Improve nested rules in validated data (#23708)
src/Illuminate/Validation/Validator.php
@@ -306,11 +306,17 @@ public function validate() throw new ValidationException($this); } - $data = collect($this->getData()); + $results = []; - return $data->only(collect($this->getRules())->keys()->map(function ($rule) { - return explode('.', $rule)[0]; - })->unique())->toArray(); + $rules = collect($this->getRules())->keys()->map(function ($rule) { + return Str::contains($rule, '*') ? explode('.', $rule)[0] : $rule; + })->unique(); + + foreach ($rules as $rule) { + Arr::set($results, $rule, data_get($this->getData(), $rule)); + } + + return $results; } /**
true
Other
laravel
framework
0a56560863125853873997013b43f6ab1eeb5c2c.json
Improve nested rules in validated data (#23708)
tests/Foundation/FoundationFormRequestTest.php
@@ -34,6 +34,17 @@ public function test_validated_method_returns_the_validated_data() $this->assertEquals(['name' => 'specified'], $request->validated()); } + public function test_validated_method_returns_the_validated_data_nested_rules() + { + $payload = ['nested' => ['foo' => 'bar', 'baz' => ''], 'array' => [1, 2]]; + + $request = $this->createRequest($payload, FoundationTestFormRequestNestedStub::class); + + $request->validateResolved(); + + $this->assertEquals(['nested' => ['foo' => 'bar'], 'array' => [1, 2]], $request->validated()); + } + /** * @expectedException \Illuminate\Validation\ValidationException */ @@ -174,6 +185,19 @@ public function authorize() } } +class FoundationTestFormRequestNestedStub extends FormRequest +{ + public function rules() + { + return ['nested.foo' => 'required', 'array.*' => 'integer']; + } + + public function authorize() + { + return true; + } +} + class FoundationTestFormRequestForbiddenStub extends FormRequest { public function rules()
true
Other
laravel
framework
0a56560863125853873997013b43f6ab1eeb5c2c.json
Improve nested rules in validated data (#23708)
tests/Validation/ValidationValidatorTest.php
@@ -3902,6 +3902,21 @@ public function testValidateReturnsValidatedData() $this->assertEquals(['first' => 'john', 'preferred' => 'john'], $data); } + public function testValidateReturnsValidatedDataNestedRules() + { + $post = ['nested' => ['foo' => 'bar', 'baz' => ''], 'array' => [1, 2]]; + + $rules = ['nested.foo' => 'required', 'array.*' => 'integer']; + + $v = new Validator($this->getIlluminateArrayTranslator(), $post, $rules); + $v->sometimes('type', 'required', function () { + return false; + }); + $data = $v->validate(); + + $this->assertEquals(['nested' => ['foo' => 'bar'], 'array' => [1, 2]], $data); + } + protected function getTranslator() { return m::mock('Illuminate\Contracts\Translation\Translator');
true
Other
laravel
framework
b1af5287d00d9cf72df20e189b9140e0bc23aaaa.json
Get Blade compiler from Engine Resolver (#23710) If one registers a custom Blade compiler ( such as https://github.com/HTMLMin/Laravel-HTMLMin ) that replaces the built-in compiler, all Blade directives registration through the Blade Façade are registered with the custom compiler and not the built-in one. As the `view:cache` command didn't retrieve the compiler from the EngineResolver but used the built-in one, when a user that uses a custom compiler runs this command, no custom directive is compiled. This commit fixes this by retrieving the compiler from the EngineResolver, so there are no conflicts with packages that register a custom Blade compiler. (For reference see the Blade Façade: https://github.com/laravel/framework/blob/5.6/src/Illuminate/Support/Facades/Blade.php#L34 )
src/Illuminate/Foundation/Console/ViewCacheCommand.php
@@ -45,7 +45,7 @@ public function handle() */ protected function compileViews(Collection $views) { - $compiler = $this->laravel['blade.compiler']; + $compiler = $this->laravel['view']->getEngineResolver()->resolve('blade')->getCompiler(); $views->map(function (SplFileInfo $file) use ($compiler) { $compiler->compile($file->getRealPath());
false
Other
laravel
framework
ce879dd84d2d86023a0d50c6e34873a0b25fddd3.json
Add SlackMessage::info (#23711) I know it defaults to `info` but it's useful to be explicit about it in some cases.
src/Illuminate/Notifications/Messages/SlackMessage.php
@@ -83,6 +83,18 @@ class SlackMessage */ public $http = []; + /** + * Indicate that the notification gives information about an operation. + * + * @return $this + */ + public function info() + { + $this->level = 'info'; + + return $this; + } + /** * Indicate that the notification gives information about a successful operation. *
false
Other
laravel
framework
53510ea30b58dd4510b20b241202a896db1cd261.json
Add unit testing for the withoutTouchingOn method
tests/Database/DatabaseEloquentModelTest.php
@@ -1716,6 +1716,23 @@ public function testWithoutTouchingCallback() $this->assertTrue($model->shouldTouch()); } + public function testWithoutTouchingOnCallback() + { + $model = new EloquentModelStub(['id' => 1]); + + $called = false; + + $this->assertTrue($model->shouldTouch()); + + Model::withoutTouchingOn([EloquentModelStub::class], function () use (&$called, $model) { + $this->assertFalse($model->shouldTouch()); + $called = true; + }); + + $this->assertTrue($called); + $this->assertTrue($model->shouldTouch()); + } + protected function addMockConnection($model) { $model->setConnectionResolver($resolver = m::mock('Illuminate\Database\ConnectionResolverInterface'));
false
Other
laravel
framework
cb6e308e19754db5a7d5ee42c1334a28001ac5e1.json
Add callback support to "optional" (#23688)
src/Illuminate/Support/helpers.php
@@ -718,11 +718,16 @@ function object_get($object, $key, $default = null) * Provide access to optional objects. * * @param mixed $value + * @param callable|null $callback * @return mixed */ - function optional($value = null) + function optional($value = null, callable $callback = null) { - return new Optional($value); + if (is_null($callback)) { + return new Optional($value); + } elseif (! is_null($value)) { + return $callback($value); + } } }
true
Other
laravel
framework
cb6e308e19754db5a7d5ee42c1334a28001ac5e1.json
Add callback support to "optional" (#23688)
tests/Support/SupportHelpersTest.php
@@ -784,6 +784,19 @@ public function something() })->something()); } + public function testOptionalWithCallback() + { + $this->assertNull(optional(null, function () { + throw new RuntimeException( + 'The optional callback should not be called for null' + ); + })); + + $this->assertEquals(10, optional(5, function ($number) { + return $number * 2; + })); + } + public function testOptionalWithArray() { $this->assertEquals('here', optional(['present' => 'here'])['present']);
true
Other
laravel
framework
dab389fe56a91e85c15eb598800f6527f4ef13b8.json
Apply fixes from StyleCI (#23683)
tests/View/ViewFactoryTest.php
@@ -562,7 +562,7 @@ public function testAddingLoopDoesNotCloseGenerator() $data = (new class { public function generate() { - for($count = 0; $count < 3; $count++) { + for ($count = 0; $count < 3; $count++) { yield ['a', 'b']; } }
false
Other
laravel
framework
c6677976f694ee470a9693dc1687700d25281313.json
Apply fixes from StyleCI (#23682)
tests/View/ViewFactoryTest.php
@@ -562,7 +562,7 @@ public function testAddingLoopDoesNotCloseGenerator() $data = (new class { public function generate() { - for($count = 0; $count < 3; $count++) { + for ($count = 0; $count < 3; $count++) { yield ['a', 'b']; } }
false
Other
laravel
framework
43676756ba8eb51fe63030fbc6c00239369f6e31.json
Add Eloquent Collection loadMorph() Allow nested relations to be eager loaded for morphTo() relationships of mixed classes. e.g., class ActivityFeed { function parentable() { return $this->morphTo(); } } $collection = ActivityFeed::with('parentable') ->get() ->loadMorph('parentable', [ Event::class => 'calendar', Photo::class => 'tags', Post::class => ['author', 'commentsCount'], ]); or $paginator = ActivityFeed::with('parentable') ->paginate() ->loadMorph('parentable', [ // etc. ]);
src/Illuminate/Database/Eloquent/Collection.php
@@ -62,6 +62,30 @@ public function load($relations) return $this; } + /** + * Load a set of relationships onto the mixed relationship collection. + * + * @param string $relation + * @param array $relations + * @return $this + */ + public function loadMorph($relation, $relations) + { + $this->pluck($relation) + ->groupBy(function ($model) { + return get_class($model); + }) + ->filter(function ($models, $className) use ($relations) { + return Arr::has($relations, $className); + }) + ->each(function ($models, $className) use ($relations) { + $className::with($relations[$className]) + ->eagerLoadRelations($models->all()); + }); + + return $this; + } + /** * Add an item to the collection. *
true
Other
laravel
framework
43676756ba8eb51fe63030fbc6c00239369f6e31.json
Add Eloquent Collection loadMorph() Allow nested relations to be eager loaded for morphTo() relationships of mixed classes. e.g., class ActivityFeed { function parentable() { return $this->morphTo(); } } $collection = ActivityFeed::with('parentable') ->get() ->loadMorph('parentable', [ Event::class => 'calendar', Photo::class => 'tags', Post::class => ['author', 'commentsCount'], ]); or $paginator = ActivityFeed::with('parentable') ->paginate() ->loadMorph('parentable', [ // etc. ]);
src/Illuminate/Pagination/AbstractPaginator.php
@@ -521,6 +521,20 @@ public function setCollection(Collection $collection) return $this; } + /** + * Load a set of relationships onto the mixed relationship collection. + * + * @param string $relation + * @param array $relations + * @return $this + */ + public function loadMorph($relation, $relations) + { + $this->getCollection()->loadMorph($relation, $relations); + + return $this; + } + /** * Determine if the given item exists. *
true
Other
laravel
framework
43676756ba8eb51fe63030fbc6c00239369f6e31.json
Add Eloquent Collection loadMorph() Allow nested relations to be eager loaded for morphTo() relationships of mixed classes. e.g., class ActivityFeed { function parentable() { return $this->morphTo(); } } $collection = ActivityFeed::with('parentable') ->get() ->loadMorph('parentable', [ Event::class => 'calendar', Photo::class => 'tags', Post::class => ['author', 'commentsCount'], ]); or $paginator = ActivityFeed::with('parentable') ->paginate() ->loadMorph('parentable', [ // etc. ]);
tests/Database/DatabaseEloquentPolymorphicIntegrationTest.php
@@ -4,7 +4,6 @@ use PHPUnit\Framework\TestCase; use Illuminate\Database\Connection; -use Illuminate\Database\Query\Builder; use Illuminate\Database\Capsule\Manager as DB; use Illuminate\Database\Eloquent\Model as Eloquent; @@ -119,6 +118,26 @@ public function testItLoadsNestedRelationshipsOnDemand() $this->assertEquals(TestUser::first(), $like->likeable->owner); } + public function testItLoadsNestedMorphRelationshipsOnDemand() + { + $this->seedData(); + + TestPost::first()->likes()->create([]); + + $likes = TestLike::with('likeable.owner')->get()->loadMorph('likeable', [ + TestComment::class => ['commentable'], + TestPost::class => 'comments', + ]); + + $this->assertTrue($likes[0]->relationLoaded('likeable')); + $this->assertTrue($likes[0]->likeable->relationLoaded('owner')); + $this->assertTrue($likes[0]->likeable->relationLoaded('commentable')); + + $this->assertTrue($likes[1]->relationLoaded('likeable')); + $this->assertTrue($likes[1]->likeable->relationLoaded('owner')); + $this->assertTrue($likes[1]->likeable->relationLoaded('comments')); + } + /** * Helpers... */ @@ -144,7 +163,7 @@ protected function connection() /** * Get a schema builder instance. * - * @return Schema\Builder + * @return \Illuminate\Database\Schema\Builder */ protected function schema() { @@ -183,6 +202,11 @@ public function owner() { return $this->belongsTo(TestUser::class, 'user_id'); } + + public function likes() + { + return $this->morphMany(TestLike::class, 'likeable'); + } } /**
true
Other
laravel
framework
43676756ba8eb51fe63030fbc6c00239369f6e31.json
Add Eloquent Collection loadMorph() Allow nested relations to be eager loaded for morphTo() relationships of mixed classes. e.g., class ActivityFeed { function parentable() { return $this->morphTo(); } } $collection = ActivityFeed::with('parentable') ->get() ->loadMorph('parentable', [ Event::class => 'calendar', Photo::class => 'tags', Post::class => ['author', 'commentsCount'], ]); or $paginator = ActivityFeed::with('parentable') ->paginate() ->loadMorph('parentable', [ // etc. ]);
tests/Pagination/PaginatorLoadMorphTest.php
@@ -0,0 +1,27 @@ +<?php + +namespace Illuminate\Tests\Pagination; + +use Mockery; +use PHPUnit\Framework\TestCase; +use Illuminate\Database\Eloquent\Collection; +use Illuminate\Pagination\AbstractPaginator; + +class PaginatorLoadMorphTest extends TestCase +{ + public function testCollectionLoadMorphCanChainOnThePaginator() + { + $relations = [ + 'App\\User' => 'photos', + 'App\\Company' => ['employees', 'calendars'], + ]; + + $items = Mockery::mock(Collection::class); + $items->shouldReceive('loadMorph')->once()->with('parentable', $relations); + + $p = (new class extends AbstractPaginator { + })->setCollection($items); + + $this->assertSame($p, $p->loadMorph('parentable', $relations)); + } +}
true
Other
laravel
framework
5520954154908c2c72d5f28e17dcf256a2eea81e.json
Apply fixes from StyleCI (#23671)
tests/Database/DatabaseEloquentTimestamps.php
@@ -2,11 +2,11 @@ namespace Illuminate\Tests\Database; -use Illuminate\Database\Capsule\Manager as DB; -use Illuminate\Database\Connection; -use Illuminate\Database\Eloquent\Model as Eloquent; use Illuminate\Support\Carbon; use PHPUnit\Framework\TestCase; +use Illuminate\Database\Connection; +use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Database\Eloquent\Model as Eloquent; class DatabaseEloquentTimestamps extends TestCase { @@ -77,7 +77,6 @@ public function testUserWithCreatedAtAndUpdatedAt() $this->assertEquals($now->toDateTimeString(), $user->updated_at->toDateTimeString()); } - public function testUserWithCreatedAt() { $now = Carbon::now();
false
Other
laravel
framework
b6fc316b1ff1bb8df4288726e9784de03925a21c.json
use 403 status code (#23662)
src/Illuminate/Routing/Exceptions/InvalidSignatureException.php
@@ -14,6 +14,6 @@ class InvalidSignatureException extends HttpException */ public function __construct() { - parent::__construct(401, 'Invalid signature.'); + parent::__construct(403, 'Invalid signature.'); } }
false
Other
laravel
framework
5c80cdda2bf8e30d96cffb8458dceb86f563f7af.json
Apply fixes from StyleCI (#23659)
src/Illuminate/Foundation/Exceptions/Handler.php
@@ -12,9 +12,7 @@ use Illuminate\Http\JsonResponse; use Illuminate\Support\Facades\Auth; use Illuminate\Support\ViewErrorBag; -use Illuminate\Filesystem\Filesystem; use Illuminate\Http\RedirectResponse; -use Whoops\Handler\PrettyPageHandler; use Illuminate\Auth\AuthenticationException; use Illuminate\Contracts\Container\Container; use Illuminate\Contracts\Support\Responsable;
false
Other
laravel
framework
74cf20355da753b3b9baf15ab2a1ad49d6d21e52.json
Apply fixes from StyleCI (#23649)
tests/Database/DatabaseEloquentTimestamps.php
@@ -2,11 +2,11 @@ namespace Illuminate\Tests\Database; -use Illuminate\Database\Capsule\Manager as DB; -use Illuminate\Database\Connection; -use Illuminate\Database\Eloquent\Model as Eloquent; use Illuminate\Support\Carbon; use PHPUnit\Framework\TestCase; +use Illuminate\Database\Connection; +use Illuminate\Database\Capsule\Manager as DB; +use Illuminate\Database\Eloquent\Model as Eloquent; class DatabaseEloquentTimestamps extends TestCase { @@ -77,7 +77,6 @@ public function testUserWithCreatedAtAndUpdatedAt() $this->assertEquals($now->toDateTimeString(), $user->updated_at->toDateTimeString()); } - public function testUserWithCreatedAt() { $now = Carbon::now();
false
Other
laravel
framework
3538cbdd704b3e816aa3b2087c4ceec63e91e82b.json
Apply fixes from StyleCI (#23644)
src/Illuminate/Database/Eloquent/FactoryBuilder.php
@@ -412,7 +412,7 @@ protected function callAfter(array $afterCallbacks, $models) */ protected function callAfterCallbacks(array $afterCallbacks, $model, $state) { - if (!isset($afterCallbacks[$this->class][$state])) { + if (! isset($afterCallbacks[$this->class][$state])) { return; }
true
Other
laravel
framework
3538cbdd704b3e816aa3b2087c4ceec63e91e82b.json
Apply fixes from StyleCI (#23644)
tests/Integration/Database/EloquentFactoryBuilderTest.php
@@ -89,7 +89,7 @@ protected function getEnvironmentSetUp($app) ]; }); - $factory->afterCreatingState(FactoryBuildableUser::class, 'with_callable_server', function(FactoryBuildableUser $user, Generator $faker){ + $factory->afterCreatingState(FactoryBuildableUser::class, 'with_callable_server', function (FactoryBuildableUser $user, Generator $faker) { $server = factory(FactoryBuildableServer::class) ->states('callable') ->create(['user_id' => $user->id]);
true