add controllers, servoices

This commit is contained in:
root
2026-03-09 02:52:13 -04:00
parent c8de5f7edc
commit d76c871cb7
501 changed files with 34439 additions and 21843 deletions
@@ -0,0 +1,51 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
App\Support\SqliteCompat::statement(<<<'SQL'
CREATE TABLE `current_incident` (
`id` int UNSIGNED NOT NULL,
`student_id` int NOT NULL,
`student_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
`grade` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
`incident` enum('payment','attendance','grade','behavior','talking_off_task','calling_out','minor_disruption','minor_dress_code','forgetting_materials','repeated_defiance','disrespectful_tone','minor_profanity','repeated_tardiness','device_misuse','minor_conflict','bullying_harassment','fighting_aggression','threats','theft','vandalism','sexual_harassment','serious_cyber_incident','contraband','weapons_drugs','other') COLLATE utf8mb4_general_ci NOT NULL,
`incident_datetime` datetime NOT NULL,
`incident_state` enum('Open','Closed','Canceled') COLLATE utf8mb4_general_ci DEFAULT 'Open',
`updated_by_open` int DEFAULT NULL,
`open_description` text COLLATE utf8mb4_general_ci,
`updated_by_closed` int DEFAULT NULL,
`close_description` text COLLATE utf8mb4_general_ci,
`action_taken` text COLLATE utf8mb4_general_ci,
`updated_by_canceled` int DEFAULT NULL,
`cancel_description` text COLLATE utf8mb4_general_ci,
`semester` varchar(25) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci NOT NULL,
`school_year` varchar(9) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL,
`created_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP,
`updated_at` timestamp NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
SQL
);
App\Support\SqliteCompat::statement(<<<'SQL'
ALTER TABLE `current_incident`
ADD PRIMARY KEY (`id`);
SQL
);
App\Support\SqliteCompat::statement(<<<'SQL'
ALTER TABLE `current_incident`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
SQL
);
}
public function down(): void
{
Schema::dropIfExists('current_incident');
}
};
@@ -9,14 +9,14 @@ return new class extends Migration
public function up(): void
{
App\Support\SqliteCompat::statement(<<<'SQL'
CREATE TABLE `flag` (
CREATE TABLE `incident` (
`id` int UNSIGNED NOT NULL,
`student_id` int NOT NULL,
`student_name` varchar(255) COLLATE utf8mb4_general_ci NOT NULL,
`grade` varchar(50) COLLATE utf8mb4_general_ci NOT NULL,
`flag` enum('payment','attendance','grade','behavior','talking_off_task','calling_out','minor_disruption','minor_dress_code','forgetting_materials','repeated_defiance','disrespectful_tone','minor_profanity','repeated_tardiness','device_misuse','minor_conflict','bullying_harassment','fighting_aggression','threats','theft','vandalism','sexual_harassment','serious_cyber_incident','contraband','weapons_drugs','other') COLLATE utf8mb4_general_ci NOT NULL,
`flag_datetime` datetime NOT NULL,
`flag_state` enum('Closed','Canceled') COLLATE utf8mb4_general_ci NOT NULL,
`incident` enum('payment','attendance','grade','behavior','talking_off_task','calling_out','minor_disruption','minor_dress_code','forgetting_materials','repeated_defiance','disrespectful_tone','minor_profanity','repeated_tardiness','device_misuse','minor_conflict','bullying_harassment','fighting_aggression','threats','theft','vandalism','sexual_harassment','serious_cyber_incident','contraband','weapons_drugs','other') COLLATE utf8mb4_general_ci NOT NULL,
`incident_datetime` datetime NOT NULL,
`incident_state` enum('Closed','Canceled') COLLATE utf8mb4_general_ci NOT NULL,
`updated_by_open` int DEFAULT NULL,
`open_description` text COLLATE utf8mb4_general_ci,
`updated_by_closed` int DEFAULT NULL,
@@ -33,13 +33,13 @@ SQL
);
App\Support\SqliteCompat::statement(<<<'SQL'
ALTER TABLE `flag`
ALTER TABLE `incident`
ADD PRIMARY KEY (`id`);
SQL
);
App\Support\SqliteCompat::statement(<<<'SQL'
ALTER TABLE `flag`
ALTER TABLE `incident`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
SQL
);
@@ -48,6 +48,6 @@ SQL
public function down(): void
{
Schema::dropIfExists('flag');
Schema::dropIfExists('incident');
}
};
@@ -0,0 +1,53 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
App\Support\SqliteCompat::statement(<<<'SQL'
CREATE TABLE `communication_logs` (
`id` int UNSIGNED NOT NULL,
`student_id` int UNSIGNED NOT NULL,
`family_id` int UNSIGNED NOT NULL,
`student_name` varchar(255) DEFAULT NULL,
`template_key` varchar(100) DEFAULT NULL,
`subject` varchar(255) DEFAULT NULL,
`body` mediumtext DEFAULT NULL,
`recipients` text DEFAULT NULL,
`cc` text DEFAULT NULL,
`bcc` text DEFAULT NULL,
`attachments` text DEFAULT NULL,
`status` varchar(32) DEFAULT NULL,
`error_message` text DEFAULT NULL,
`sent_by` int UNSIGNED DEFAULT NULL,
`metadata` text DEFAULT NULL,
`created_at` datetime DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci;
SQL
);
App\Support\SqliteCompat::statement(<<<'SQL'
ALTER TABLE `communication_logs`
ADD PRIMARY KEY (`id`),
ADD KEY `communication_logs_student_id` (`student_id`),
ADD KEY `communication_logs_family_id` (`family_id`),
ADD KEY `communication_logs_sent_by` (`sent_by`);
SQL
);
App\Support\SqliteCompat::statement(<<<'SQL'
ALTER TABLE `communication_logs`
MODIFY `id` int(11) UNSIGNED NOT NULL AUTO_INCREMENT;
SQL
);
}
public function down(): void
{
Schema::dropIfExists('communication_logs');
}
};
@@ -0,0 +1,33 @@
<?php
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('personal_access_tokens', function (Blueprint $table) {
$table->id();
$table->morphs('tokenable');
$table->text('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable()->index();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};
@@ -0,0 +1,31 @@
<?php
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('sessions', function (Blueprint $table) {
$table->string('id')->primary();
$table->foreignId('user_id')->nullable()->index();
$table->string('ip_address', 45)->nullable();
$table->text('user_agent')->nullable();
$table->longText('payload');
$table->integer('last_activity')->index();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('sessions');
}
};