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

[5.5] Make seeders chainable #22288

Merged
merged 1 commit into from
Dec 3, 2017
Merged

[5.5] Make seeders chainable #22288

merged 1 commit into from
Dec 3, 2017

Conversation

freekmurze
Copy link
Contributor

Right now you must call seeders in DatabaseSeeder like this:

$this->call(SeederA::class);
$this->call(SeederB::class);
$this->call(SeederC::class);

The changes in this PR will enable to do the above like this

$this
   ->call(SeederA::class);
   ->call(SeederB::class);
   ->call(SeederC::class);

@freekmurze freekmurze changed the title Make seeders chainable [5.5] Make seeders chainable Dec 2, 2017
@antonkomarev
Copy link
Contributor

antonkomarev commented Dec 2, 2017

What is the profit from it?

Wouldn't it be better to make:

$this->call([
    SeederA::class,
    SeederB::class,
    SeederC::class,
]);

Or:

$this->calls([
    SeederA::class,
    SeederB::class,
    SeederC::class,
]);

@devcircus
Copy link
Contributor

Can't you already do

$this->call([
    SeederA::class,
    SeederB::class,
]);

@taylorotwell taylorotwell merged commit a919819 into laravel:5.5 Dec 3, 2017
@browner12
Copy link
Contributor

@devcircus yes you can. I'm not really seeing the benefit of chaining, but oh well, it's already in.

@freekmurze freekmurze deleted the chainable-seeders branch December 4, 2017 10:22
@lbm-trentm
Copy link

if no one can really see the benefit to this, why bloat the software?

@nachofassini
Copy link

nachofassini commented Dec 11, 2017

what @a-komarev proposes its already implemented. Seeder docs

@deleugpn
Copy link
Contributor

@lbm-trentm The PR creator, people liking the PR and Taylor seem to disagree with your premise.

@antonkomarev
Copy link
Contributor

@deleugpn nobody said that we are disagree with this PR. Question of reason was raised and this behavior was available already, as @nachofassini pointed to docs.

One minor notice that in first comment bad example is provided. It should be:

$this
   ->call(SeederA::class)
   ->call(SeederB::class)
   ->call(SeederC::class);

@connectkushal
Copy link
Contributor

connectkushal commented Dec 11, 2017

to those grumbling about bloating the software without any benefit, this pr adds just 2 extra words to the actual code, return $this 🙄

@browner12
Copy link
Contributor

Lingchi - Death by 1000 cuts.

Mostly trolling, but our initial point was this was a solution to a problem that already had a solution.

It's in now, so /shrug

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants