flexisip-account-manager/flexiapi/database/factories/ExternalAccountFactory.php
Timothée Jaussoin 7a17897193 Add ExternalAccounts and related features
- Consume an ExternalAccount on Account creation
- Add a tombstone to an ExternalAccount to ensure non re-usage
- Add related tests
- Generalize Utils
- Stop public registration when there is no ExternalAccounts left
- Add GenerateExternalAccounts, ExportToExternalAccounts and ImportExternalAccounts console scripts
- Provision the ExternalAccount using the depends_on/idkey pair
2022-07-12 17:05:17 +02:00

25 lines
632 B
PHP

<?php
namespace Database\Factories;
use App\ExternalAccount;
use Illuminate\Database\Eloquent\Factories\Factory;
class ExternalAccountFactory extends Factory
{
protected $model = ExternalAccount::class;
public function definition()
{
$username = $this->faker->username;
$realm = config('app.realm') ?? config('app.sip_domain');
return [
'username' => $username,
'domain' => config('app.sip_domain'),
'group' => 'test',
'password' => hash('sha256', $username.':'.$realm.':testtest'),
'algorithm' => 'SHA-256',
];
}
}