Initial commit of testapi

This commit is contained in:
2025-06-20 13:33:07 +02:00
commit a455aba1d5
377 changed files with 30566 additions and 0 deletions
+58
View File
@@ -0,0 +1,58 @@
<?php
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
use App\Models\SmartdokProfile;
use App\Models\Department;
use App\Models\Project;
use App\Models\WorkHour;
class RmDemoData extends Command
{
/**
* The name and signature of the console command.
*
* @var string
*/
protected $signature = 'rmdemodata';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Remove all demo data for SmartdokProfile, Department, Project, and WorkHour models';
/**
* Execute the console command.
*
* @return int
*/
public function handle()
{
$this->info('Removing all demo data...');
// Disable foreign key checks for all supported DB drivers
Schema::disableForeignKeyConstraints();
// Truncate pivot tables
DB::table('project_smartdok_profile')->truncate();
DB::table('department_project')->truncate();
// Truncate core tables
WorkHour::truncate();
Project::truncate();
SmartdokProfile::truncate();
Department::truncate();
// Re-enable foreign key checks
Schema::enableForeignKeyConstraints();
$this->info('All demo data removed successfully.');
return 0;
}
}