Skip to content

Commit

Permalink
add countable interface to eloquent factory sequence (#39907)
Browse files Browse the repository at this point in the history
* add countable interface to eloquent factory sequence

* Update Sequence.php

Co-authored-by: Taylor Otwell <taylor@laravel.com>
  • Loading branch information
acurrieclark and taylorotwell committed Dec 6, 2021
1 parent e772d1d commit 7105924
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/Illuminate/Database/Eloquent/Factories/Sequence.php
Expand Up @@ -2,7 +2,9 @@

namespace Illuminate\Database\Eloquent\Factories;

class Sequence
use Countable;

class Sequence implements Countable
{
/**
* The sequence of return values.
Expand Down Expand Up @@ -37,6 +39,16 @@ public function __construct(...$sequence)
$this->count = count($sequence);
}

/**
* Get the current count of the sequence items.
*
* @return int
*/
public function count()
{
return $this->count;
}

/**
* Get the next value in the sequence.
*
Expand Down

0 comments on commit 7105924

Please sign in to comment.