- Introduced `ConnectedAppFactory` for generating connected app data. - Added `MockDataSeeder` to create sample roles, users, and apps with dynamic role-app assignments. - Extended `RoleAndAppsPermissionEnum` with `ConnectApps` permission. - Updated access-manager UI to handle app-connection actions with proper authorization. - Integrated app-role connection logic in Livewire component and updated `roles-and-apps` view for permissions-based actions.
36 lines
1.1 KiB
PHP
36 lines
1.1 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace Database\Factories;
|
|
|
|
use App\Models\{ConnectedApp, ConnectionProtocol, ConnectionProvider, ConnectionStatus};
|
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
|
use Illuminate\Support\Str;
|
|
|
|
/**
|
|
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\ConnectedApp>
|
|
*/
|
|
class ConnectedAppFactory extends Factory
|
|
{
|
|
protected $model = ConnectedApp::class;
|
|
|
|
/**
|
|
* Define the model's default state.
|
|
*
|
|
* @return array<string, mixed>
|
|
*/
|
|
public function definition(): array
|
|
{
|
|
$name = $this->faker->unique()->company().' '.$this->faker->randomElement(['SSO', 'Portal', 'OAuth', 'API', 'App']);
|
|
|
|
return [
|
|
'name' => $name,
|
|
'slug' => Str::slug($name),
|
|
'connection_protocol_id' => ConnectionProtocol::inRandomOrder()->first()?->id ?? 1,
|
|
'connection_provider_id' => ConnectionProvider::inRandomOrder()->first()?->id ?? 1,
|
|
'connection_status_id' => ConnectionStatus::inRandomOrder()->first()?->id ?? 1,
|
|
];
|
|
}
|
|
}
|