Skip to content

Commit

Permalink
add files
Browse files Browse the repository at this point in the history
  • Loading branch information
taylorotwell committed Dec 24, 2020
1 parent 2a2ae6d commit e0a62e5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 17 deletions.
30 changes: 15 additions & 15 deletions DatabaseBatchRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
use Illuminate\Database\Query\Expression;
use Illuminate\Support\Str;

class DatabaseBatchRepository implements BatchRepository, Prunable
class DatabaseBatchRepository implements PrunableBatchRepository
{
/**
* The batch factory instance.
Expand Down Expand Up @@ -231,23 +231,10 @@ public function delete(string $batchId)
$this->connection->table($this->table)->where('id', $batchId)->delete();
}

/**
* Execute the given Closure within a storage specific transaction.
*
* @param \Closure $callback
* @return mixed
*/
public function transaction(Closure $callback)
{
return $this->connection->transaction(function () use ($callback) {
return $callback();
});
}

/**
* Prune all of the entries older than the given date.
*
* @param DateTimeInterface $before
* @param \DateTimeInterface $before
* @return int
*/
public function prune(DateTimeInterface $before)
Expand All @@ -267,6 +254,19 @@ public function prune(DateTimeInterface $before)
return $totalDeleted;
}

/**
* Execute the given Closure within a storage specific transaction.
*
* @param \Closure $callback
* @return mixed
*/
public function transaction(Closure $callback)
{
return $this->connection->transaction(function () use ($callback) {
return $callback();
});
}

/**
* Convert the given raw batch to a Batch object.
*
Expand Down
4 changes: 2 additions & 2 deletions Prunable.php → PrunableBatchRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

use DateTimeInterface;

interface Prunable
interface PrunableBatchRepository extends BatchRepository
{
/**
* Prune all of the entries older than the given date.
*
* @param DateTimeInterface $before
* @param \DateTimeInterface $before
* @return int
*/
public function prune(DateTimeInterface $before);
Expand Down

0 comments on commit e0a62e5

Please sign in to comment.