Skip to content

More then one row beeing adding to relational models #109

@dimpu

Description

@dimpu

I trying to follow the tutorial at https://laracasts.com/lessons/whats-new-in-testdummy by @JeffreyWay

When i have code as

$factory('App\User',[
    'name' => $faker->name,
    'email' => $faker->email,
    'password'=> bcrypt('Passw0rd')
]);
$factory('App\Post',[
    'title' => $faker->name,
        'user_id' => 'factory:App\User'
]);

and my DatabaseSeeder.php

<?php
use Illuminate\Database\Seeder;
use Illuminate\Database\Eloquent\Model;

class DatabaseSeeder extends Seeder
{
    /**
     * Run the database seeds.
     *
     * @return void
     */
    public function run()
    {
        Model::unguard();
        $this->call(PostTableSeeder::class);
        Model::reguard();
    }
}

Now the issue is in database i can see there are many users created in database.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions