- Introduced `is_unlimited` field in `app_roles` table to support roles with unlimited duration. - Enhanced front-end and back-end implementations to manage unlimited roles, including UI updates and validation. - Refactored `KekaOutlookController` and `KekaOutlookService` for streamlined exception handling and code consistency. - Applied linting and formatting improvements across updated files.
33 lines
695 B
PHP
33 lines
695 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,
|
|
public bool $isUnlimited = false,
|
|
) {}
|
|
|
|
/**
|
|
* 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
|
|
);
|
|
}
|
|
}
|