feat: fitur koreksi odometer, kamera scan qr unit, remember me 30 hari, dan strict route guard 403

This commit is contained in:
Ray1111-aa
2026-10-19 23:21:55 +07:00
parent d216322ac6
commit e08b81e0c2
32 changed files with 2232 additions and 189 deletions
@@ -0,0 +1,39 @@
<?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::table('vehicle_activities', function (Blueprint $table) {
$table->boolean('is_corrected')->default(false)->after('rejection_note');
$table->decimal('original_current_km', 12, 2)->nullable()->after('is_corrected');
$table->text('correction_reason')->nullable()->after('original_current_km');
$table->foreignId('corrected_by_user_id')->nullable()->after('correction_reason')->constrained('users')->nullOnDelete();
$table->timestamp('corrected_at')->nullable()->after('corrected_by_user_id');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('vehicle_activities', function (Blueprint $table) {
$table->dropForeign(['corrected_by_user_id']);
$table->dropColumn([
'is_corrected',
'original_current_km',
'correction_reason',
'corrected_by_user_id',
'corrected_at',
]);
});
}
};
@@ -0,0 +1,31 @@
<?php
use App\Models\Employee;
use App\Models\User;
use Illuminate\Database\Migrations\Migration;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
// Pastikan seluruh user dengan role employee memiliki profil data master Employee
$users = User::where('role', 'employee')
->orWhereHas('roles', fn ($q) => $q->where('name', 'employee'))
->get();
foreach ($users as $user) {
$user->getOrCreateEmployee();
}
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Tidak perlu menghapus data employee karena aman untuk backwards compatibility
}
};