Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add countable interface to eloquent factory sequence #39907

Merged
merged 2 commits into from Dec 6, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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()
driesvints marked this conversation as resolved.
Show resolved Hide resolved
{
return $this->count;
}

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