Skip to content

Commit

Permalink
remove superfluous ForceDelete extension from SoftDeletingScope (#17552)
Browse files Browse the repository at this point in the history
  • Loading branch information
ockle authored and taylorotwell committed Jan 26, 2017
1 parent eac8e19 commit 90b011c
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 28 deletions.
15 changes: 1 addition & 14 deletions src/Illuminate/Database/Eloquent/SoftDeletingScope.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class SoftDeletingScope implements Scope
*
* @var array
*/
protected $extensions = ['ForceDelete', 'Restore', 'WithTrashed', 'WithoutTrashed', 'OnlyTrashed'];
protected $extensions = ['Restore', 'WithTrashed', 'WithoutTrashed', 'OnlyTrashed'];

/**
* Apply the scope to a given Eloquent query builder.
Expand Down Expand Up @@ -59,19 +59,6 @@ protected function getDeletedAtColumn(Builder $builder)
return $builder->getModel()->getDeletedAtColumn();
}

/**
* Add the force delete extension to the builder.
*
* @param \Illuminate\Database\Eloquent\Builder $builder
* @return void
*/
protected function addForceDelete(Builder $builder)
{
$builder->macro('forceDelete', function (Builder $builder) {
return $builder->getQuery()->delete();
});
}

/**
* Add the restore extension to the builder.
*
Expand Down
14 changes: 0 additions & 14 deletions tests/Database/DatabaseSoftDeletingScopeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,6 @@ public function testApplyingScopeToABuilder()
$scope->apply($builder, $model);
}

public function testForceDeleteExtension()
{
$builder = m::mock('Illuminate\Database\Eloquent\Builder');
$builder->shouldDeferMissing();
$scope = new \Illuminate\Database\Eloquent\SoftDeletingScope;
$scope->extend($builder);
$callback = $builder->getMacro('forceDelete');
$givenBuilder = m::mock('Illuminate\Database\Eloquent\Builder');
$givenBuilder->shouldReceive('getQuery')->andReturn($query = m::mock('StdClass'));
$query->shouldReceive('delete')->once();

$callback($givenBuilder);
}

public function testRestoreExtension()
{
$builder = m::mock('Illuminate\Database\Eloquent\Builder');
Expand Down

0 comments on commit 90b011c

Please sign in to comment.