Skip to content

Commit

Permalink
feat: Enhance session time handling and add migration to set all user…
Browse files Browse the repository at this point in the history
… session times to -1
  • Loading branch information
dogukanoksuz committed Jan 31, 2025
1 parent 32b5c02 commit e7c1a75
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 0 deletions.
2 changes: 2 additions & 0 deletions app/Http/Controllers/API/ProfileController.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ public function setInformation(Request $request)
$session_time = env('JWT_TTL', 120);
if ($request->session_time == $session_time) {
$session_time = -1;
} else {
$session_time = $request->session_time;
}

$user->update([
Expand Down
2 changes: 2 additions & 0 deletions app/Http/Controllers/API/Settings/UserController.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,8 @@ public function update(Request $request)
$session_time = env('JWT_TTL', 120);
if ($request->session_time == $session_time) {
$session_time = -1;
} else {
$session_time = $request->session_time;
}

$data = [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
DB::table('users')->update(['session_time' => -1]);
}

/**
* Reverse the migrations.
*/
public function down(): void
{
// No need to reverse this migration
}
};

0 comments on commit e7c1a75

Please sign in to comment.