create( [ 'name' => 'WebDeveloper', 'email' => 'developer@example.com', 'role'=> 'DEVELOPER', ] ); // website admin User::factory()->create( [ 'name' => 'Admin', 'email' => 'admin@example.com', 'role'=> 'ADMIN', ] ); // website user User::factory()->create( [ 'name' => 'ManagerUser', 'email' => 'user@example.com', ] ); // add roles foreach (User::$roles as $role) { $r = new Role(); $r->name = strtolower($role); $r->save(); } $developer = User::whereId(1)->first(); $developer->assignRole('developer'); $developer->save(); $admin = User::whereId(2)->first(); $admin->assignRole('admin'); $admin->save(); $user = User::whereId(3)->first(); $user->assignRole('user'); $user->save(); } }