diff --git a/database/factories/UserFactory.php b/database/factories/AssociateFactory.php similarity index 83% rename from database/factories/UserFactory.php rename to database/factories/AssociateFactory.php index d7bf9fc..3f2ffb7 100644 --- a/database/factories/UserFactory.php +++ b/database/factories/AssociateFactory.php @@ -2,10 +2,10 @@ /** @var \Illuminate\Database\Eloquent\Factory $factory */ -use App\User; -use App\UserCategory; -use App\UserNature; -use App\UserType; +use App\Associate; +use App\AssociateCategory; +use App\AssociateNature; +use App\AssociateType; use Carbon\Carbon; use Faker\Generator as Faker; use Illuminate\Support\Str; @@ -21,14 +21,14 @@ use Illuminate\Support\Str; | */ -$factory->define(User::class, function (Faker $faker) { +$factory->define(Associate::class, function (Faker $faker) { return [ 'name' => $faker->name, 'email' => $faker->unique()->safeEmail, 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password - 'user_category_id' => UserCategory::where('key', 'individual')->first()->id, - 'user_nature_id' => UserNature::where('key', 'individual')->first()->id, - 'user_type_id' => UserType::where('key', 'individual')->first()->id, + 'associate_category_id' => AssociateCategory::where('key', 'individual')->first()->id, + 'associate_nature_id' => AssociateNature::where('key', 'individual')->first()->id, + 'associate_type_id' => AssociateType::where('key', 'individual')->first()->id, 'birthday' => Carbon::createFromFormat('d/m/Y', $faker->date('d/m/Y')), 'document' => [ 'type' => 'cpf', diff --git a/database/factories/CollaboratorFactory.php b/database/factories/CollaboratorFactory.php new file mode 100644 index 0000000..bcb8dba --- /dev/null +++ b/database/factories/CollaboratorFactory.php @@ -0,0 +1,27 @@ +define(Collaborator::class, function (Faker $faker) { + return [ + 'name' => $faker->name, + 'email' => $faker->unique()->safeEmail, + 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password + 'remember_token' => Str::random(10), + ]; +}); diff --git a/database/seeds/UserSeeder.php b/database/seeds/AssociateSeeder.php similarity index 51% rename from database/seeds/UserSeeder.php rename to database/seeds/AssociateSeeder.php index 0882445..f0bf0a1 100644 --- a/database/seeds/UserSeeder.php +++ b/database/seeds/AssociateSeeder.php @@ -1,9 +1,9 @@ create(); + Associate::flushEventListeners(); + factory(Associate::class, 20)->create(); } } diff --git a/database/seeds/CollaboratorSeeder.php b/database/seeds/CollaboratorSeeder.php new file mode 100644 index 0000000..3060cb4 --- /dev/null +++ b/database/seeds/CollaboratorSeeder.php @@ -0,0 +1,23 @@ +create([ + 'name' => 'Administrador', + 'email' => 'administrador@administrador.com', + 'password' => Hash::make('administrador'), + ]); + } +} diff --git a/database/seeds/DatabaseSeeder.php b/database/seeds/DatabaseSeeder.php index cceafbf..8f8e62a 100644 --- a/database/seeds/DatabaseSeeder.php +++ b/database/seeds/DatabaseSeeder.php @@ -11,6 +11,7 @@ class DatabaseSeeder extends Seeder */ public function run() { - $this->call(UserSeeder::class); + $this->call(CollaboratorSeeder::class); + $this->call(AssociateSeeder::class); } }