mercredi 19 avril 2017

laravel model factory remove variable name from factory

Can I remove the name from this model factory?

$factory->define(App\User::class, function (Faker\Generator $faker) {
    return [
        'name' => $faker->name,
        'email' => $faker->email,
        'password' => bcrypt(str_random(10)),
        'remember_token' => str_random(10),
    ];
});

because i write unit test and create user in it and i get this error PDOException: SQLSTATE[42S22]: Column not found: 1054 Unknown column 'name' in 'field list' my user model is consist of firstname and lastname



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire