diff --git a/src/Models/UserModel.php b/src/Models/UserModel.php index d89e1da..29b6e42 100644 --- a/src/Models/UserModel.php +++ b/src/Models/UserModel.php @@ -3,6 +3,7 @@ namespace Myth\Auth\Models; use CodeIgniter\Model; +use Faker\Generator; use Myth\Auth\Authorization\GroupModel; use Myth\Auth\Entities\User; @@ -108,4 +109,16 @@ protected function addToGroup($data) return $data; } + + /** + * Faked data for Fabricator. + */ + public function fake(Generator &$faker): User + { + return new User([ + 'email' => $faker->email, + 'username' => $faker->userName, + 'password' => bin2hex(random_bytes(16)), + ]); + } } diff --git a/src/Test/Fakers/UserFaker.php b/src/Test/Fakers/UserFaker.php index e0555d5..142f61c 100644 --- a/src/Test/Fakers/UserFaker.php +++ b/src/Test/Fakers/UserFaker.php @@ -2,21 +2,8 @@ namespace Myth\Auth\Test\Fakers; -use Faker\Generator; -use Myth\Auth\Entities\User; use Myth\Auth\Models\UserModel; class UserFaker extends UserModel { - /** - * Faked data for Fabricator. - */ - public function fake(Generator &$faker): User - { - return new User([ - 'email' => $faker->email, - 'username' => $faker->userName, - 'password' => bin2hex(random_bytes(16)), - ]); - } }