feat: fitur koreksi odometer, kamera scan qr unit, remember me 30 hari, dan strict route guard 403
This commit is contained in:
+39
@@ -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
|
||||
}
|
||||
};
|
||||
@@ -47,6 +47,7 @@ class RolePermissionSeeder extends Seeder
|
||||
'qma.vehicles.edit',
|
||||
'qma.vehicles.delete',
|
||||
'qma.logs.view',
|
||||
'qma.logs.edit_odometer',
|
||||
'qma.summary.view',
|
||||
'qma.p2h.view',
|
||||
'qma.p2h.approve',
|
||||
|
||||
Reference in New Issue
Block a user