singleloginsystem/database/migrations/2026_05_18_113635_app_roles.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

34 lines
808 B
PHP

<?php
declare(strict_types=1);
use App\Models\ConnectedApp;
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class() extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::create('app_roles', function (Blueprint $table): void {
$table->id();
$table->foreignIdFor(ConnectedApp::class, 'app_id');
$table->foreignId('role_id')->comment('role_id from spatie roles table');
$table->dateTime('duration');
$table->unique(['app_id', 'role_id']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('app_roles');
}
};