singleloginsystem/app/Data/Role/RoleAppData.php
= fd57ac57e1 Feat: refactor app role duration to validity date
- Replaced `duration` (integer, days) with `validUpto` (datetime) in role-app assignments.
- Updated `AssignAppsToRoleData`, `AppRole` model, and Livewire forms to adopt the new `validUpto` field.
- Adjusted database migrations and UI components to reflect the change in validity representation.
- Enhanced validity date inputs with support for "Unlimited" roles using toggles.
2026-05-21 06:38:05 +00:00

32 lines
653 B
PHP

<?php
declare(strict_types=1);
namespace App\Data\Role;
use App\Models\ConnectedApp;
use Spatie\LaravelData\Data;
final class RoleAppData extends Data
{
public function __construct(
public int $id,
public int $appId,
public string $appName,
public string $duration,
) {}
/**
* Intercept the Eloquent model and map it to the DTO properties.
*/
public static function fromModel(ConnectedApp $app): self
{
return new self(
id: $app->pivot->id,
appId: $app->id,
appName: $app->name,
duration: $app->pivot->duration
);
}
}