fix data setting get datatable using api token

This commit is contained in:
arifal
2025-06-17 11:54:02 +07:00
parent a8b02afad9
commit 285ff46c2b
10 changed files with 586 additions and 56 deletions

View File

@@ -0,0 +1,45 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
class ClearDatabaseSessions extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'session:clear-db {--force : Force the operation without confirmation}';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Clear all database sessions';
/**
* Execute the console command.
*/
public function handle()
{
if (!$this->option('force') && !$this->confirm('Are you sure you want to clear all database sessions?')) {
$this->info('Operation cancelled.');
return 0;
}
try {
$count = DB::table('sessions')->count();
DB::table('sessions')->delete();
$this->info("Successfully cleared {$count} database sessions.");
return 0;
} catch (\Exception $e) {
$this->error('Failed to clear database sessions: ' . $e->getMessage());
return 1;
}
}
}