* @license https://opensource.org/licenses/OSL-3.0 Open Software License (OSL 3.0) */ namespace Database\Factories; use Illuminate\Database\Eloquent\Factories\Factory; use Illuminate\Support\Facades\Hash; use InnoShop\Common\Models\Admin; /** * @extends Factory */ class AdminFactory extends Factory { protected $model = Admin::class; protected static ?string $password; public function definition(): array { return [ 'name' => fake()->name(), 'email' => fake()->unique()->safeEmail(), 'password' => static::$password ??= Hash::make('password'), 'locale' => 'en', 'active' => true, ]; } public function inactive(): static { return $this->state(fn (array $attributes) => [ 'active' => false, ]); } }