- 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.
32 lines
653 B
PHP
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
|
|
);
|
|
}
|
|
}
|