feat: add app and database modules
This commit is contained in:
@@ -0,0 +1 @@
|
||||
*.sqlite*
|
||||
@@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\AiHealingLog;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
|
||||
class AiHealingLogFactory extends Factory
|
||||
{
|
||||
protected $model = AiHealingLog::class;
|
||||
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'error_type' => 'Exception',
|
||||
'error_message' => $this->faker->sentence,
|
||||
'stack_trace' => $this->faker->text,
|
||||
'status' => 'pending',
|
||||
'ai_diagnosis' => $this->faker->paragraph,
|
||||
'action_taken' => $this->faker->sentence,
|
||||
];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Illuminate\Support\Str;
|
||||
|
||||
/**
|
||||
* @extends Factory<User>
|
||||
*/
|
||||
class UserFactory extends Factory
|
||||
{
|
||||
/**
|
||||
* The current password being used by the factory.
|
||||
*/
|
||||
protected static ?string $password;
|
||||
|
||||
/**
|
||||
* Define the model's default state.
|
||||
*
|
||||
* @return array<string, mixed>
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
return [
|
||||
'name' => fake()->name(),
|
||||
'email' => fake()->unique()->safeEmail(),
|
||||
'email_verified_at' => now(),
|
||||
'password' => static::$password ??= Hash::make('password'),
|
||||
'remember_token' => Str::random(10),
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Indicate that the model's email address should be unverified.
|
||||
*/
|
||||
public function unverified(): static
|
||||
{
|
||||
return $this->state(fn (array $attributes) => [
|
||||
'email_verified_at' => null,
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('name');
|
||||
$table->string('email')->unique();
|
||||
$table->timestamp('email_verified_at')->nullable();
|
||||
$table->string('password');
|
||||
$table->rememberToken();
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
Schema::create('password_reset_tokens', function (Blueprint $table) {
|
||||
$table->string('email')->primary();
|
||||
$table->string('token');
|
||||
$table->timestamp('created_at')->nullable();
|
||||
});
|
||||
|
||||
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('users');
|
||||
Schema::dropIfExists('password_reset_tokens');
|
||||
Schema::dropIfExists('sessions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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('cache', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->mediumText('value');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
|
||||
Schema::create('cache_locks', function (Blueprint $table) {
|
||||
$table->string('key')->primary();
|
||||
$table->string('owner');
|
||||
$table->integer('expiration');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('cache');
|
||||
Schema::dropIfExists('cache_locks');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,57 @@
|
||||
<?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('jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('queue')->index();
|
||||
$table->longText('payload');
|
||||
$table->unsignedTinyInteger('attempts');
|
||||
$table->unsignedInteger('reserved_at')->nullable();
|
||||
$table->unsignedInteger('available_at');
|
||||
$table->unsignedInteger('created_at');
|
||||
});
|
||||
|
||||
Schema::create('job_batches', function (Blueprint $table) {
|
||||
$table->string('id')->primary();
|
||||
$table->string('name');
|
||||
$table->integer('total_jobs');
|
||||
$table->integer('pending_jobs');
|
||||
$table->integer('failed_jobs');
|
||||
$table->longText('failed_job_ids');
|
||||
$table->mediumText('options')->nullable();
|
||||
$table->integer('cancelled_at')->nullable();
|
||||
$table->integer('created_at');
|
||||
$table->integer('finished_at')->nullable();
|
||||
});
|
||||
|
||||
Schema::create('failed_jobs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('uuid')->unique();
|
||||
$table->text('connection');
|
||||
$table->text('queue');
|
||||
$table->longText('payload');
|
||||
$table->longText('exception');
|
||||
$table->timestamp('failed_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('jobs');
|
||||
Schema::dropIfExists('job_batches');
|
||||
Schema::dropIfExists('failed_jobs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,140 @@
|
||||
<?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
|
||||
{
|
||||
$teams = config('permission.teams');
|
||||
$tableNames = config('permission.table_names');
|
||||
$columnNames = config('permission.column_names');
|
||||
$pivotRole = $columnNames['role_pivot_key'] ?? 'role_id';
|
||||
$pivotPermission = $columnNames['permission_pivot_key'] ?? 'permission_id';
|
||||
|
||||
throw_if(empty($tableNames), Exception::class, 'Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
throw_if($teams && empty($columnNames['team_foreign_key'] ?? null), Exception::class, 'Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
|
||||
|
||||
Schema::create($tableNames['permissions'], static function (Blueprint $table) {
|
||||
// $table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // permission id
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->softDeletes();
|
||||
|
||||
$table->unique(['name', 'guard_name']);
|
||||
});
|
||||
|
||||
Schema::create($tableNames['roles'], static function (Blueprint $table) use ($teams, $columnNames) {
|
||||
// $table->engine('InnoDB');
|
||||
$table->bigIncrements('id'); // role id
|
||||
if ($teams || config('permission.testing')) { // permission.testing is a fix for sqlite testing
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key'])->nullable();
|
||||
$table->index($columnNames['team_foreign_key'], 'roles_team_foreign_key_index');
|
||||
}
|
||||
$table->string('name'); // For MyISAM use string('name', 225); // (or 166 for InnoDB with Redundant/Compact row format)
|
||||
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
|
||||
$table->timestamps();
|
||||
$table->unsignedBigInteger('created_by')->nullable();
|
||||
$table->unsignedBigInteger('updated_by')->nullable();
|
||||
$table->softDeletes();
|
||||
if ($teams || config('permission.testing')) {
|
||||
$table->unique([$columnNames['team_foreign_key'], 'name', 'guard_name']);
|
||||
} else {
|
||||
$table->unique(['name', 'guard_name']);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_permissions'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotPermission, $teams) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_permissions_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_permissions_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotPermission, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_permissions_permission_model_type_primary');
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Schema::create($tableNames['model_has_roles'], static function (Blueprint $table) use ($tableNames, $columnNames, $pivotRole, $teams) {
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->string('model_type');
|
||||
$table->unsignedBigInteger($columnNames['model_morph_key']);
|
||||
$table->index([$columnNames['model_morph_key'], 'model_type'], 'model_has_roles_model_id_model_type_index');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
if ($teams) {
|
||||
$table->unsignedBigInteger($columnNames['team_foreign_key']);
|
||||
$table->index($columnNames['team_foreign_key'], 'model_has_roles_team_foreign_key_index');
|
||||
|
||||
$table->primary([$columnNames['team_foreign_key'], $pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
} else {
|
||||
$table->primary([$pivotRole, $columnNames['model_morph_key'], 'model_type'],
|
||||
'model_has_roles_role_model_type_primary');
|
||||
}
|
||||
});
|
||||
|
||||
Schema::create($tableNames['role_has_permissions'], static function (Blueprint $table) use ($tableNames, $pivotRole, $pivotPermission) {
|
||||
$table->unsignedBigInteger($pivotPermission);
|
||||
$table->unsignedBigInteger($pivotRole);
|
||||
|
||||
$table->foreign($pivotPermission)
|
||||
->references('id') // permission id
|
||||
->on($tableNames['permissions'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreign($pivotRole)
|
||||
->references('id') // role id
|
||||
->on($tableNames['roles'])
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->primary([$pivotPermission, $pivotRole], 'role_has_permissions_permission_id_role_id_primary');
|
||||
});
|
||||
|
||||
app('cache')
|
||||
->store(config('permission.cache.store') != 'default' ? config('permission.cache.store') : null)
|
||||
->forget(config('permission.cache.key'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$tableNames = config('permission.table_names');
|
||||
|
||||
throw_if(empty($tableNames), Exception::class, 'Error: config/permission.php not found and defaults could not be merged. Please publish the package configuration before proceeding, or drop the tables manually.');
|
||||
|
||||
Schema::drop($tableNames['role_has_permissions']);
|
||||
Schema::drop($tableNames['model_has_roles']);
|
||||
Schema::drop($tableNames['model_has_permissions']);
|
||||
Schema::drop($tableNames['roles']);
|
||||
Schema::drop($tableNames['permissions']);
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
class CreateActivityLogTable extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->create(config('activitylog.table_name'), function (Blueprint $table) {
|
||||
$table->bigIncrements('id');
|
||||
$table->string('log_name')->nullable();
|
||||
$table->text('description');
|
||||
$table->nullableMorphs('subject', 'subject');
|
||||
$table->nullableMorphs('causer', 'causer');
|
||||
$table->json('properties')->nullable();
|
||||
$table->uuid('batch_uuid')->nullable();
|
||||
$table->string('event')->nullable();
|
||||
$table->timestamps();
|
||||
$table->index('log_name');
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::connection(config('activitylog.database_connection'))->dropIfExists(config('activitylog.table_name'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('notifications', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
// Konten utama
|
||||
$table->string('title');
|
||||
$table->text('message');
|
||||
|
||||
// Target penerima (Hierarchical: all, user, admin, superadmin, or user_id)
|
||||
$table->string('recipient')->index();
|
||||
|
||||
// Jenis notifikasi
|
||||
$table->enum('type', ['info', 'warning', 'system'])->default('info');
|
||||
|
||||
// Status baca
|
||||
$table->timestamp('read_at')->nullable();
|
||||
|
||||
// Pembuat notifikasi
|
||||
$table->foreignId('created_by')
|
||||
->nullable()
|
||||
->constrained('users')
|
||||
->nullOnDelete();
|
||||
|
||||
$table->timestamps();
|
||||
$table->softDeletes();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('media', function (Blueprint $table) {
|
||||
$table->id();
|
||||
|
||||
$table->morphs('model');
|
||||
$table->uuid()->nullable()->unique();
|
||||
$table->string('collection_name');
|
||||
$table->string('name');
|
||||
$table->string('file_name');
|
||||
$table->string('mime_type')->nullable();
|
||||
$table->string('disk');
|
||||
$table->string('conversions_disk')->nullable();
|
||||
$table->unsignedBigInteger('size');
|
||||
$table->json('manipulations');
|
||||
$table->json('custom_properties');
|
||||
$table->json('generated_conversions');
|
||||
$table->json('responsive_images');
|
||||
$table->unsignedInteger('order_column')->nullable()->index();
|
||||
|
||||
$table->nullableTimestamps();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_settings', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('key', 120)->unique();
|
||||
$table->text('value')->nullable();
|
||||
$table->string('type', 30)->default('string');
|
||||
$table->string('group', 50)->default('general');
|
||||
$table->boolean('is_public')->default(false);
|
||||
$table->string('description', 190)->nullable();
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_settings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('system_setting_revisions', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('system_setting_id')->constrained('system_settings')->cascadeOnDelete();
|
||||
$table->string('key', 120);
|
||||
$table->longText('old_value')->nullable();
|
||||
$table->longText('new_value')->nullable();
|
||||
$table->foreignId('changed_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
$table->string('changed_ip', 45)->nullable();
|
||||
$table->text('changed_agent')->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('system_setting_revisions');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?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
|
||||
{
|
||||
// 1. Update Users Table
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->timestamp('password_changed_at')->nullable()->after('password');
|
||||
});
|
||||
|
||||
// 2. Create Password Histories Table
|
||||
Schema::create('password_histories', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->string('password');
|
||||
$table->timestamps();
|
||||
});
|
||||
|
||||
// 3. Create User Trusted Devices Table
|
||||
Schema::create('user_trusted_devices', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->string('device_id')->index(); // Identitas browser/perangkat
|
||||
$table->string('token')->index(); // Signed token
|
||||
$table->timestamp('expires_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_trusted_devices');
|
||||
Schema::dropIfExists('password_histories');
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn('password_changed_at');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Laragear\WebAuthn\Models\WebAuthnCredential;
|
||||
|
||||
return WebAuthnCredential::migration()->with(function (Blueprint $table) {
|
||||
// Here you can add custom columns to the Two Factor table.
|
||||
//
|
||||
// $table->string('alias')->nullable();
|
||||
});
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Get the migration connection name.
|
||||
*/
|
||||
public function getConnection(): ?string
|
||||
{
|
||||
return config('telescope.storage.database.connection');
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$schema = Schema::connection($this->getConnection());
|
||||
|
||||
$schema->create('telescope_entries', function (Blueprint $table) {
|
||||
$table->bigIncrements('sequence');
|
||||
$table->uuid('uuid');
|
||||
$table->uuid('batch_id');
|
||||
$table->string('family_hash')->nullable();
|
||||
$table->boolean('should_display_on_index')->default(true);
|
||||
$table->string('type', 20);
|
||||
$table->longText('content');
|
||||
$table->dateTime('created_at')->nullable();
|
||||
|
||||
$table->unique('uuid');
|
||||
$table->index('batch_id');
|
||||
$table->index('family_hash');
|
||||
$table->index('created_at');
|
||||
$table->index(['type', 'should_display_on_index']);
|
||||
});
|
||||
|
||||
$schema->create('telescope_entries_tags', function (Blueprint $table) {
|
||||
$table->uuid('entry_uuid');
|
||||
$table->string('tag');
|
||||
|
||||
$table->primary(['entry_uuid', 'tag']);
|
||||
$table->index('tag');
|
||||
|
||||
$table->foreign('entry_uuid')
|
||||
->references('uuid')
|
||||
->on('telescope_entries')
|
||||
->cascadeOnDelete();
|
||||
});
|
||||
|
||||
$schema->create('telescope_monitoring', function (Blueprint $table) {
|
||||
$table->string('tag')->primary();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
$schema = Schema::connection($this->getConnection());
|
||||
|
||||
$schema->dropIfExists('telescope_entries_tags');
|
||||
$schema->dropIfExists('telescope_entries');
|
||||
$schema->dropIfExists('telescope_monitoring');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?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('notification_user', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('notification_id')->constrained()->onDelete('cascade');
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamp('deleted_at')->nullable(); // Personal soft-delete for the broadcast
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['notification_id', 'user_id']);
|
||||
$table->unique(['notification_id', 'user_id']);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notification_user');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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('user_consents', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$table->string('consent_type'); // 'tos', 'pdp', 'marketing', etc.
|
||||
$table->unsignedInteger('version_id'); // Current version ID of the document
|
||||
$table->string('ip_address', 45); // IPv4 or IPv6
|
||||
$table->text('user_agent')->nullable();
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('user_consents');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::rename('notifications', 'system_notifications');
|
||||
Schema::rename('notification_user', 'system_notification_user');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::rename('system_notifications', 'notifications');
|
||||
Schema::rename('system_notification_user', 'notification_user');
|
||||
}
|
||||
};
|
||||
@@ -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('notifications', function (Blueprint $table) {
|
||||
$table->uuid('id')->primary();
|
||||
$table->string('type');
|
||||
$table->morphs('notifiable');
|
||||
$table->text('data');
|
||||
$table->timestamp('read_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notifications');
|
||||
}
|
||||
};
|
||||
@@ -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,29 @@
|
||||
<?php
|
||||
|
||||
// MOBILE APPS
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('transactions', function (Blueprint $blueprint) {
|
||||
$blueprint->id();
|
||||
$blueprint->foreignId('user_id')->constrained()->onDelete('cascade');
|
||||
$blueprint->string('title');
|
||||
$blueprint->decimal('amount', 15, 2);
|
||||
$blueprint->string('type'); // income, expense
|
||||
$blueprint->string('category')->nullable();
|
||||
$blueprint->string('icon')->nullable();
|
||||
$blueprint->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('transactions');
|
||||
}
|
||||
};
|
||||
@@ -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('mobile_settings', function (Blueprint $t) {
|
||||
$t->id();
|
||||
$t->string('key')->unique();
|
||||
$t->text('value')->nullable();
|
||||
$t->string('group')->default('general'); // theme, localization, flags, etc.
|
||||
$t->string('type')->default('string'); // string, json, boolean
|
||||
$t->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('mobile_settings');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,26 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('mobile_sync_logs', function (Blueprint $row) {
|
||||
$row->id();
|
||||
$row->foreignId('user_id')->nullable()->constrained()->onDelete('set null');
|
||||
$row->string('platform')->nullable();
|
||||
$row->string('device_model')->nullable();
|
||||
$row->string('app_version')->nullable();
|
||||
$row->string('ip_address')->nullable();
|
||||
$row->timestamp('synced_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('mobile_sync_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up()
|
||||
{
|
||||
Schema::create('mobile_error_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->onDelete('set null');
|
||||
$table->string('error_type')->default('RuntimeError');
|
||||
$table->text('message');
|
||||
$table->longText('stack_trace')->nullable();
|
||||
$table->string('platform')->nullable();
|
||||
$table->string('app_version')->nullable();
|
||||
$table->json('device_info')->nullable();
|
||||
$table->timestamp('occurred_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
public function down()
|
||||
{
|
||||
Schema::dropIfExists('mobile_error_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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('imports', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->string('file_name');
|
||||
$table->string('file_path');
|
||||
$table->string('importer');
|
||||
$table->unsignedInteger('processed_rows')->default(0);
|
||||
$table->unsignedInteger('total_rows');
|
||||
$table->unsignedInteger('successful_rows')->default(0);
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('imports');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,35 @@
|
||||
<?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('exports', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->timestamp('completed_at')->nullable();
|
||||
$table->string('file_disk');
|
||||
$table->string('file_name')->nullable();
|
||||
$table->string('exporter');
|
||||
$table->unsignedInteger('processed_rows')->default(0);
|
||||
$table->unsignedInteger('total_rows');
|
||||
$table->unsignedInteger('successful_rows')->default(0);
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('exports');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,30 @@
|
||||
<?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('failed_import_rows', function (Blueprint $table): void {
|
||||
$table->id();
|
||||
$table->json('data');
|
||||
$table->foreignId('import_id')->constrained()->cascadeOnDelete();
|
||||
$table->text('validation_error')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('failed_import_rows');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Laravel\Pulse\Support\PulseMigration;
|
||||
|
||||
return new class extends PulseMigration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! $this->shouldRun()) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('pulse_values', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('timestamp');
|
||||
$table->string('type');
|
||||
$table->mediumText('key');
|
||||
match ($this->driver()) {
|
||||
'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
|
||||
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
|
||||
'sqlite' => $table->string('key_hash'),
|
||||
};
|
||||
$table->mediumText('value');
|
||||
|
||||
$table->index('timestamp'); // For trimming...
|
||||
$table->index('type'); // For fast lookups and purging...
|
||||
$table->unique(['type', 'key_hash']); // For data integrity and upserts...
|
||||
});
|
||||
|
||||
Schema::create('pulse_entries', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('timestamp');
|
||||
$table->string('type');
|
||||
$table->mediumText('key');
|
||||
match ($this->driver()) {
|
||||
'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
|
||||
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
|
||||
'sqlite' => $table->string('key_hash'),
|
||||
};
|
||||
$table->bigInteger('value')->nullable();
|
||||
|
||||
$table->index('timestamp'); // For trimming...
|
||||
$table->index('type'); // For purging...
|
||||
$table->index('key_hash'); // For mapping...
|
||||
$table->index(['timestamp', 'type', 'key_hash', 'value']); // For aggregate queries...
|
||||
});
|
||||
|
||||
Schema::create('pulse_aggregates', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('bucket');
|
||||
$table->unsignedMediumInteger('period');
|
||||
$table->string('type');
|
||||
$table->mediumText('key');
|
||||
match ($this->driver()) {
|
||||
'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
|
||||
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
|
||||
'sqlite' => $table->string('key_hash'),
|
||||
};
|
||||
$table->string('aggregate');
|
||||
$table->decimal('value', 20, 2);
|
||||
$table->unsignedInteger('count')->nullable();
|
||||
|
||||
$table->unique(['bucket', 'period', 'type', 'aggregate', 'key_hash']); // Force "on duplicate update"...
|
||||
$table->index(['period', 'bucket']); // For trimming...
|
||||
$table->index('type'); // For purging...
|
||||
$table->index(['period', 'type', 'aggregate', 'bucket']); // For aggregate queries...
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pulse_values');
|
||||
Schema::dropIfExists('pulse_entries');
|
||||
Schema::dropIfExists('pulse_aggregates');
|
||||
}
|
||||
};
|
||||
@@ -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::create('ai_usage_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->nullable()->constrained()->onDelete('set null');
|
||||
$table->string('provider');
|
||||
$table->string('model');
|
||||
$table->longText('prompt')->nullable();
|
||||
$table->longText('response')->nullable();
|
||||
$table->integer('prompt_tokens')->default(0);
|
||||
$table->integer('completion_tokens')->default(0);
|
||||
$table->integer('total_tokens')->default(0);
|
||||
$table->decimal('estimated_cost', 10, 6)->default(0);
|
||||
$table->string('status')->default('success'); // success, failed
|
||||
$table->text('error_message')->nullable();
|
||||
$table->json('metadata')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ai_usage_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,40 @@
|
||||
<?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('roles', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('roles', 'deleted_at')) {
|
||||
$table->softDeletes();
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('permissions', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('permissions', 'deleted_at')) {
|
||||
$table->softDeletes();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('roles', function (Blueprint $table) {
|
||||
$table->dropSoftDeletes();
|
||||
});
|
||||
|
||||
Schema::table('permissions', function (Blueprint $table) {
|
||||
$table->dropSoftDeletes();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
$table->string('username')->nullable()->unique()->after('name');
|
||||
$table->string('phone_number')->nullable()->after('email');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['username', 'phone_number']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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::table('users', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('users', 'created_by')) {
|
||||
$table->foreignId('created_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
}
|
||||
if (! Schema::hasColumn('users', 'updated_by')) {
|
||||
$table->foreignId('updated_by')->nullable()->constrained('users')->nullOnDelete();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['created_by', 'updated_by']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,36 @@
|
||||
<?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('users', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('users', 'deleted_at')) {
|
||||
$table->softDeletes();
|
||||
}
|
||||
if (! Schema::hasColumn('users', 'is_active')) {
|
||||
$table->boolean('is_active')->default(true);
|
||||
}
|
||||
if (! Schema::hasColumn('users', 'last_session_id')) {
|
||||
$table->string('last_session_id')->nullable();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
$table->dropColumn(['deleted_at', 'is_active', 'last_session_id']);
|
||||
});
|
||||
}
|
||||
};
|
||||
+40
@@ -0,0 +1,40 @@
|
||||
<?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('roles', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('roles', 'is_active')) {
|
||||
$table->boolean('is_active')->default(true);
|
||||
}
|
||||
});
|
||||
|
||||
Schema::table('permissions', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('permissions', 'is_active')) {
|
||||
$table->boolean('is_active')->default(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('roles', function (Blueprint $table) {
|
||||
$table->dropColumn('is_active');
|
||||
});
|
||||
|
||||
Schema::table('permissions', function (Blueprint $table) {
|
||||
$table->dropColumn('is_active');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('otp_codes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('identifier')->index();
|
||||
$table->string('code', 6);
|
||||
$table->timestamp('expires_at');
|
||||
$table->timestamp('verified_at')->nullable();
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('otp_codes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('device_tokens', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('token')->unique();
|
||||
$table->enum('platform', ['ios', 'android', 'web'])->default('android');
|
||||
$table->string('device_name')->nullable();
|
||||
$table->string('app_version')->nullable();
|
||||
$table->timestamp('last_used_at')->nullable();
|
||||
$table->timestamps();
|
||||
|
||||
$table->index(['user_id', 'platform']);
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('device_tokens');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,84 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
use Laravel\Pulse\Support\PulseMigration;
|
||||
|
||||
return new class extends PulseMigration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
if (! $this->shouldRun() || Schema::hasTable('pulse_values')) {
|
||||
return;
|
||||
}
|
||||
|
||||
Schema::create('pulse_values', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('timestamp');
|
||||
$table->string('type');
|
||||
$table->mediumText('key');
|
||||
match ($this->driver()) {
|
||||
'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
|
||||
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
|
||||
'sqlite' => $table->string('key_hash'),
|
||||
};
|
||||
$table->mediumText('value');
|
||||
|
||||
$table->index('timestamp'); // For trimming...
|
||||
$table->index('type'); // For fast lookups and purging...
|
||||
$table->unique(['type', 'key_hash']); // For data integrity and upserts...
|
||||
});
|
||||
|
||||
Schema::create('pulse_entries', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('timestamp');
|
||||
$table->string('type');
|
||||
$table->mediumText('key');
|
||||
match ($this->driver()) {
|
||||
'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
|
||||
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
|
||||
'sqlite' => $table->string('key_hash'),
|
||||
};
|
||||
$table->bigInteger('value')->nullable();
|
||||
|
||||
$table->index('timestamp'); // For trimming...
|
||||
$table->index('type'); // For purging...
|
||||
$table->index('key_hash'); // For mapping...
|
||||
$table->index(['timestamp', 'type', 'key_hash', 'value']); // For aggregate queries...
|
||||
});
|
||||
|
||||
Schema::create('pulse_aggregates', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->unsignedInteger('bucket');
|
||||
$table->unsignedMediumInteger('period');
|
||||
$table->string('type');
|
||||
$table->mediumText('key');
|
||||
match ($this->driver()) {
|
||||
'mariadb', 'mysql' => $table->char('key_hash', 16)->charset('binary')->virtualAs('unhex(md5(`key`))'),
|
||||
'pgsql' => $table->uuid('key_hash')->storedAs('md5("key")::uuid'),
|
||||
'sqlite' => $table->string('key_hash'),
|
||||
};
|
||||
$table->string('aggregate');
|
||||
$table->decimal('value', 20, 2);
|
||||
$table->unsignedInteger('count')->nullable();
|
||||
|
||||
$table->unique(['bucket', 'period', 'type', 'aggregate', 'key_hash']); // Force "on duplicate update"...
|
||||
$table->index(['period', 'bucket']); // For trimming...
|
||||
$table->index('type'); // For purging...
|
||||
$table->index(['period', 'type', 'aggregate', 'bucket']); // For aggregate queries...
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('pulse_values');
|
||||
Schema::dropIfExists('pulse_entries');
|
||||
Schema::dropIfExists('pulse_aggregates');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
if (! Schema::hasColumn('users', 'google_id')) {
|
||||
$table->string('google_id')->nullable()->after('password')->index();
|
||||
}
|
||||
if (! Schema::hasColumn('users', 'facebook_id')) {
|
||||
$table->string('facebook_id')->nullable()->after('google_id')->index();
|
||||
}
|
||||
if (! Schema::hasColumn('users', 'github_id')) {
|
||||
$table->string('github_id')->nullable()->after('facebook_id')->index();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('users', function (Blueprint $table) {
|
||||
foreach (['google_id', 'facebook_id', 'github_id'] as $col) {
|
||||
if (Schema::hasColumn('users', $col)) {
|
||||
$table->dropColumn($col);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
// PostgreSQL doesn't always drop the check constraint when changing from enum to string
|
||||
// The constraint name was inherited from the old 'notifications' table name.
|
||||
DB::statement('ALTER TABLE system_notifications DROP CONSTRAINT IF EXISTS notifications_type_check');
|
||||
DB::statement('ALTER TABLE system_notifications DROP CONSTRAINT IF EXISTS system_notifications_type_check');
|
||||
|
||||
Schema::table('system_notifications', function (Blueprint $table) {
|
||||
$table->string('type')->default('info')->change();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('system_notifications', function (Blueprint $table) {
|
||||
$table->enum('type', ['info', 'warning', 'system'])->default('info')->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,32 @@
|
||||
<?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('transactions', function (Blueprint $table) {
|
||||
$table->index('type');
|
||||
$table->index('category');
|
||||
$table->index('created_at');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('transactions', function (Blueprint $table) {
|
||||
$table->dropIndex(['type']);
|
||||
$table->dropIndex(['category']);
|
||||
$table->dropIndex(['created_at']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -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::table('activity_log', function (Blueprint $table) {
|
||||
// Speed up log analysis queries for recent events
|
||||
$table->index('created_at', 'activity_log_created_at_idx');
|
||||
$table->index('event', 'activity_log_event_idx');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('activity_log', function (Blueprint $table) {
|
||||
$table->dropIndex('activity_log_created_at_idx');
|
||||
$table->dropIndex('activity_log_event_idx');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
// Postgres supports IF NOT EXISTS on CREATE INDEX, so the migration is idempotent
|
||||
// without juggling Laravel's Blueprint-level checks (which lose $this in closures).
|
||||
DB::statement('CREATE INDEX IF NOT EXISTS password_histories_user_id_created_at_index ON password_histories (user_id, created_at)');
|
||||
DB::statement('CREATE INDEX IF NOT EXISTS system_setting_revisions_key_created_at_index ON system_setting_revisions (key, created_at)');
|
||||
DB::statement('CREATE INDEX IF NOT EXISTS system_setting_revisions_changed_by_index ON system_setting_revisions (changed_by)');
|
||||
DB::statement('CREATE INDEX IF NOT EXISTS notifications_notifiable_read_at_index ON notifications (notifiable_type, notifiable_id, read_at)');
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
DB::statement('DROP INDEX IF EXISTS password_histories_user_id_created_at_index');
|
||||
DB::statement('DROP INDEX IF EXISTS system_setting_revisions_key_created_at_index');
|
||||
DB::statement('DROP INDEX IF EXISTS system_setting_revisions_changed_by_index');
|
||||
DB::statement('DROP INDEX IF EXISTS notifications_notifiable_read_at_index');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* roles and permissions had created_by/updated_by added via a separate migration
|
||||
* without FK constraints. Add them now with SET NULL so audit columns survive when
|
||||
* the actor user is force-deleted.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
$this->addFkIfMissing('roles_created_by_foreign', 'roles', 'created_by');
|
||||
$this->addFkIfMissing('roles_updated_by_foreign', 'roles', 'updated_by');
|
||||
$this->addFkIfMissing('permissions_created_by_foreign', 'permissions', 'created_by');
|
||||
$this->addFkIfMissing('permissions_updated_by_foreign', 'permissions', 'updated_by');
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
foreach (['roles_created_by_foreign', 'roles_updated_by_foreign'] as $c) {
|
||||
DB::statement("ALTER TABLE roles DROP CONSTRAINT IF EXISTS {$c}");
|
||||
}
|
||||
foreach (['permissions_created_by_foreign', 'permissions_updated_by_foreign'] as $c) {
|
||||
DB::statement("ALTER TABLE permissions DROP CONSTRAINT IF EXISTS {$c}");
|
||||
}
|
||||
}
|
||||
|
||||
private function addFkIfMissing(string $name, string $table, string $column): void
|
||||
{
|
||||
$exists = DB::selectOne(
|
||||
'SELECT 1 FROM pg_constraint WHERE conname = ?',
|
||||
[$name]
|
||||
);
|
||||
if ($exists) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Null out any orphan references first so the FK can be created.
|
||||
DB::statement("UPDATE {$table} SET {$column} = NULL WHERE {$column} IS NOT NULL AND {$column} NOT IN (SELECT id FROM users)");
|
||||
|
||||
DB::statement(
|
||||
"ALTER TABLE {$table} ADD CONSTRAINT {$name} "
|
||||
."FOREIGN KEY ({$column}) REFERENCES users(id) ON DELETE SET NULL"
|
||||
);
|
||||
}
|
||||
};
|
||||
@@ -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('ai_healing_logs', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('error_type')->nullable();
|
||||
$table->text('error_message');
|
||||
$table->longText('stack_trace')->nullable();
|
||||
$table->text('ai_diagnosis')->nullable();
|
||||
$table->string('action_taken')->nullable();
|
||||
$table->string('status')->default('pending'); // pending, diagnosing, resolved, failed
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('ai_healing_logs');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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('ai_healing_logs', function (Blueprint $table) {
|
||||
$table->longText('original_code')->after('ai_diagnosis')->nullable();
|
||||
$table->longText('fixed_code')->after('original_code')->nullable();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('ai_healing_logs', function (Blueprint $table) {
|
||||
$table->dropColumn(['original_code', 'fixed_code']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,27 @@
|
||||
<?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('permissions', function (Blueprint $table) {
|
||||
// Scope identifies the sub-resource (tab/section) this permission applies to.
|
||||
// NULL = menu-level (legacy), non-null = scoped (e.g. 'general', 'login-security').
|
||||
$table->string('scope')->nullable()->after('name')->index();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('permissions', function (Blueprint $table) {
|
||||
$table->dropColumn('scope');
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Database\Schema\Blueprint;
|
||||
use Illuminate\Support\Facades\Schema;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('dashboard_widget_preferences', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
|
||||
$table->string('widget_key', 64);
|
||||
$table->boolean('visible')->default(true);
|
||||
$table->unsignedSmallInteger('sort_order')->default(0);
|
||||
$table->timestamps();
|
||||
|
||||
$table->unique(['user_id', 'widget_key']);
|
||||
$table->index('user_id');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('dashboard_widget_preferences');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,79 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ============================================================
|
||||
*
|
||||
* @project biiproject
|
||||
*
|
||||
* @author Andika Debi Putra
|
||||
*
|
||||
* @email andikadebiputra@gmail.com
|
||||
*
|
||||
* @website https://biiproject.com
|
||||
*
|
||||
* @copyright Copyright (c) 2026 Andika Debi Putra
|
||||
* @license Proprietary - All Rights Reserved
|
||||
*
|
||||
* @version 1.0.0
|
||||
*
|
||||
* @created 2026-05-01
|
||||
* ============================================================
|
||||
*
|
||||
* Unauthorized copying, modification, distribution, or use
|
||||
* of this file is strictly prohibited without prior written
|
||||
* permission from the author.
|
||||
* ============================================================
|
||||
*/
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
use Spatie\Permission\Models\Role;
|
||||
|
||||
class AdminUserSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
// Daftar user yang akan dibuat berdasarkan role
|
||||
$users = [
|
||||
[
|
||||
'name' => 'Admin',
|
||||
'email' => 'admin@biiproject.com',
|
||||
'role' => 'Administrator',
|
||||
],
|
||||
[
|
||||
'name' => 'Developer',
|
||||
'email' => 'developer@biiproject.com',
|
||||
'role' => 'Developer',
|
||||
],
|
||||
[
|
||||
'name' => 'User',
|
||||
'email' => 'user@biiproject.com',
|
||||
'role' => 'User',
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($users as $userData) {
|
||||
$user = User::updateOrCreate(
|
||||
['email' => $userData['email']],
|
||||
[
|
||||
'name' => $userData['name'],
|
||||
'password' => Hash::make('password'),
|
||||
'email_verified_at' => now(),
|
||||
]
|
||||
);
|
||||
|
||||
// Pastikan role ada sebelum ditugaskan
|
||||
if (Role::where('name', $userData['role'])->exists()) {
|
||||
$user->syncRoles([$userData['role']]);
|
||||
}
|
||||
}
|
||||
|
||||
$this->command->info('All role-based users created successfully with password: password');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* ============================================================
|
||||
*
|
||||
* @project biiproject
|
||||
*
|
||||
* @author Andika Debi Putra
|
||||
*
|
||||
* @email andikadebiputra@gmail.com
|
||||
*
|
||||
* @website https://biiproject.com
|
||||
*
|
||||
* @copyright Copyright (c) 2026 Andika Debi Putra
|
||||
* @license Proprietary - All Rights Reserved
|
||||
*
|
||||
* @version 1.0.0
|
||||
*
|
||||
* @created 2026-05-01
|
||||
* ============================================================
|
||||
*
|
||||
* Unauthorized copying, modification, distribution, or use
|
||||
* of this file is strictly prohibited without prior written
|
||||
* permission from the author.
|
||||
* ============================================================
|
||||
*/
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class DatabaseSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$this->call([
|
||||
// Use the newly generated seeders from current database state
|
||||
UsersTableSeeder::class,
|
||||
RolesTableSeeder::class,
|
||||
PermissionsTableSeeder::class,
|
||||
ModelHasRolesTableSeeder::class,
|
||||
ModelHasPermissionsTableSeeder::class,
|
||||
RoleHasPermissionsTableSeeder::class,
|
||||
SystemSettingsTableSeeder::class,
|
||||
MobileSettingsTableSeeder::class,
|
||||
]);
|
||||
$this->call(SystemSettingsTableSeeder::class);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\MobileSetting;
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class MobileSettingSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
$settings = [
|
||||
// --- ASSETS ---
|
||||
['key' => 'theme_color_secondary', 'value' => '#1a1a1a', 'group' => 'assets', 'type' => 'string'],
|
||||
['key' => 'theme_color_primary', 'value' => '#c6f135', 'group' => 'assets', 'type' => 'string'],
|
||||
['key' => 'primary_font_family', 'value' => 'Outfit', 'group' => 'assets', 'type' => 'string'],
|
||||
['key' => 'logo_url', 'value' => '/storage/mobile-assets/logo_url_1777816317.png', 'group' => 'assets', 'type' => 'image_path'],
|
||||
['key' => 'splash_image_url', 'value' => '/storage/mobile-assets/splash_image_url_1777816317.png', 'group' => 'assets', 'type' => 'image_path'],
|
||||
|
||||
// --- GENERAL ---
|
||||
['key' => 'brand_color', 'value' => '#c6f135', 'group' => 'general', 'type' => 'string'],
|
||||
['key' => 'app_name', 'value' => 'biiproject', 'group' => 'general', 'type' => 'string'],
|
||||
['key' => 'app_version', 'value' => '2.0.0', 'group' => 'general', 'type' => 'string'],
|
||||
['key' => 'app_icon_url', 'value' => '/storage/mobile-assets/app_icon_url_1777816326.png', 'group' => 'general', 'type' => 'image_path'],
|
||||
['key' => 'store_url_android', 'value' => 'https://play.google.com/store/apps/details?id=com.biiproject', 'group' => 'general', 'type' => 'string'],
|
||||
['key' => 'store_url_ios', 'value' => 'https://apps.apple.com/app/biiproject', 'group' => 'general', 'type' => 'string'],
|
||||
|
||||
// --- FLAGS ---
|
||||
['key' => 'enable_registration', 'value' => 'true', 'group' => 'flags', 'type' => 'boolean'],
|
||||
['key' => 'enable_remember_me', 'value' => 'true', 'group' => 'flags', 'type' => 'boolean'],
|
||||
['key' => 'kill_switch_active', 'value' => 'false', 'group' => 'flags', 'type' => 'boolean'],
|
||||
['key' => 'require_otp_registration', 'value' => 'false', 'group' => 'flags', 'type' => 'boolean'],
|
||||
['key' => 'enable_biometrics', 'value' => 'false', 'group' => 'flags', 'type' => 'boolean'],
|
||||
['key' => 'enable_push_notifications', 'value' => 'true', 'group' => 'flags', 'type' => 'boolean'],
|
||||
|
||||
// --- NETWORK ---
|
||||
['key' => 'api_base_url', 'value' => 'http://192.168.8.129:8000', 'group' => 'network', 'type' => 'string'],
|
||||
['key' => 'api_timeout_ms', 'value' => '30000', 'group' => 'network', 'type' => 'integer'],
|
||||
['key' => 'api_retry_count', 'value' => '3', 'group' => 'network', 'type' => 'integer'],
|
||||
['key' => 'enable_ssl_pinning', 'value' => 'false', 'group' => 'network', 'type' => 'boolean'],
|
||||
['key' => 'environment_selector', 'value' => 'development', 'group' => 'network', 'type' => 'string'],
|
||||
['key' => 'api_version', 'value' => 'v1', 'group' => 'network', 'type' => 'string'],
|
||||
['key' => 'request_cache_ttl', 'value' => '3600', 'group' => 'network', 'type' => 'integer'],
|
||||
|
||||
// --- AUTH ---
|
||||
['key' => 'token_ttl_minutes', 'value' => '43200', 'group' => 'auth', 'type' => 'integer'],
|
||||
['key' => 'session_max_age', 'value' => '86400', 'group' => 'auth', 'type' => 'integer'],
|
||||
['key' => 'biometric_auth_type', 'value' => 'fingerprint', 'group' => 'auth', 'type' => 'string'],
|
||||
['key' => 'oauth_google_enabled', 'value' => 'false', 'group' => 'auth', 'type' => 'boolean'],
|
||||
['key' => 'oauth_apple_enabled', 'value' => 'false', 'group' => 'auth', 'type' => 'boolean'],
|
||||
['key' => 'login_max_attempts', 'value' => '5', 'group' => 'auth', 'type' => 'integer'],
|
||||
|
||||
// --- NOTIFICATION ---
|
||||
['key' => 'fcm_topic_default', 'value' => 'all_users', 'group' => 'notification', 'type' => 'string'],
|
||||
['key' => 'default_channel_id', 'value' => 'general', 'group' => 'notification', 'type' => 'string'],
|
||||
['key' => 'notification_sound_enabled', 'value' => 'true', 'group' => 'notification', 'type' => 'boolean'],
|
||||
['key' => 'badge_count_enabled', 'value' => 'true', 'group' => 'notification', 'type' => 'boolean'],
|
||||
['key' => 'priority_level', 'value' => 'high', 'group' => 'notification', 'type' => 'string'],
|
||||
|
||||
// --- SYSTEM ---
|
||||
['key' => 'sync_interval_ms', 'value' => '10000', 'group' => 'system', 'type' => 'integer'],
|
||||
['key' => 'min_app_version', 'value' => '1.0.0', 'group' => 'system', 'type' => 'string'],
|
||||
['key' => 'target_sdk_version', 'value' => '34', 'group' => 'system', 'type' => 'string'],
|
||||
['key' => 'system_timezone', 'value' => 'Asia/Jakarta', 'group' => 'system', 'type' => 'string'],
|
||||
['key' => 'google_analytics_id', 'value' => 'G-BII-2026-X', 'group' => 'system', 'type' => 'string'],
|
||||
['key' => 'default_locale', 'value' => 'en', 'group' => 'system', 'type' => 'string'],
|
||||
['key' => 'privacy_policy_url', 'value' => 'https://biiproject.com/privacy', 'group' => 'system', 'type' => 'string'],
|
||||
['key' => 'region_lock_enabled', 'value' => 'false', 'group' => 'system', 'type' => 'boolean'],
|
||||
['key' => 'min_sdk_version', 'value' => '21', 'group' => 'system', 'type' => 'string'],
|
||||
|
||||
// --- SUPPORT ---
|
||||
['key' => 'social_instagram_url', 'value' => '', 'group' => 'support', 'type' => 'string'],
|
||||
['key' => 'social_twitter_url', 'value' => '', 'group' => 'support', 'type' => 'string'],
|
||||
['key' => 'support_email', 'value' => 'support@biiproject.com', 'group' => 'support', 'type' => 'string'],
|
||||
['key' => 'support_whatsapp', 'value' => '628123456789', 'group' => 'support', 'type' => 'string'],
|
||||
['key' => 'live_chat_url', 'value' => '', 'group' => 'support', 'type' => 'string'],
|
||||
['key' => 'faq_url', 'value' => '', 'group' => 'support', 'type' => 'string'],
|
||||
|
||||
// --- ANALYTICS ---
|
||||
['key' => 'crashlytics_enabled', 'value' => 'true', 'group' => 'analytics', 'type' => 'boolean'],
|
||||
['key' => 'log_level', 'value' => 'error', 'group' => 'analytics', 'type' => 'string'],
|
||||
['key' => 'event_sampling_rate', 'value' => '1.0', 'group' => 'analytics', 'type' => 'string'],
|
||||
['key' => 'gdpr_compliance_enabled', 'value' => 'false', 'group' => 'analytics', 'type' => 'boolean'],
|
||||
];
|
||||
|
||||
foreach ($settings as $setting) {
|
||||
MobileSetting::updateOrCreate(
|
||||
['key' => $setting['key']],
|
||||
$setting
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,786 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class MobileSettingsTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/**
|
||||
* Auto generated seed file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
|
||||
\DB::table('mobile_settings')->delete();
|
||||
|
||||
\DB::table('mobile_settings')->insert(array (
|
||||
0 =>
|
||||
array (
|
||||
'id' => 1,
|
||||
'key' => 'theme_color_secondary',
|
||||
'value' => '#1a1a1a',
|
||||
'group' => 'assets',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'id' => 2,
|
||||
'key' => 'theme_color_primary',
|
||||
'value' => '#c6f135',
|
||||
'group' => 'assets',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'id' => 3,
|
||||
'key' => 'primary_font_family',
|
||||
'value' => 'Outfit',
|
||||
'group' => 'assets',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'id' => 4,
|
||||
'key' => 'logo_url',
|
||||
'value' => '/storage/mobile-assets/logo_url_1777816317.png',
|
||||
'group' => 'assets',
|
||||
'type' => 'image_path',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'id' => 5,
|
||||
'key' => 'splash_image_url',
|
||||
'value' => '/storage/mobile-assets/splash_image_url_1777816317.png',
|
||||
'group' => 'assets',
|
||||
'type' => 'image_path',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'id' => 6,
|
||||
'key' => 'brand_color',
|
||||
'value' => '#c6f135',
|
||||
'group' => 'general',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'id' => 7,
|
||||
'key' => 'app_name',
|
||||
'value' => 'biiproject',
|
||||
'group' => 'general',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
7 =>
|
||||
array (
|
||||
'id' => 8,
|
||||
'key' => 'app_version',
|
||||
'value' => '2.0.0',
|
||||
'group' => 'general',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
8 =>
|
||||
array (
|
||||
'id' => 9,
|
||||
'key' => 'app_icon_url',
|
||||
'value' => '/storage/mobile-assets/app_icon_url_1777816326.png',
|
||||
'group' => 'general',
|
||||
'type' => 'image_path',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
9 =>
|
||||
array (
|
||||
'id' => 10,
|
||||
'key' => 'store_url_android',
|
||||
'value' => 'https://play.google.com/store/apps/details?id=com.biiproject',
|
||||
'group' => 'general',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
10 =>
|
||||
array (
|
||||
'id' => 11,
|
||||
'key' => 'store_url_ios',
|
||||
'value' => 'https://apps.apple.com/app/biiproject',
|
||||
'group' => 'general',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
11 =>
|
||||
array (
|
||||
'id' => 12,
|
||||
'key' => 'enable_registration',
|
||||
'value' => 'true',
|
||||
'group' => 'flags',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
12 =>
|
||||
array (
|
||||
'id' => 13,
|
||||
'key' => 'enable_remember_me',
|
||||
'value' => 'true',
|
||||
'group' => 'flags',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
13 =>
|
||||
array (
|
||||
'id' => 15,
|
||||
'key' => 'require_otp_registration',
|
||||
'value' => 'false',
|
||||
'group' => 'flags',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
14 =>
|
||||
array (
|
||||
'id' => 16,
|
||||
'key' => 'enable_biometrics',
|
||||
'value' => 'false',
|
||||
'group' => 'flags',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
15 =>
|
||||
array (
|
||||
'id' => 17,
|
||||
'key' => 'enable_push_notifications',
|
||||
'value' => 'true',
|
||||
'group' => 'flags',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
16 =>
|
||||
array (
|
||||
'id' => 19,
|
||||
'key' => 'api_timeout_ms',
|
||||
'value' => '30000',
|
||||
'group' => 'network',
|
||||
'type' => 'integer',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
17 =>
|
||||
array (
|
||||
'id' => 20,
|
||||
'key' => 'api_retry_count',
|
||||
'value' => '3',
|
||||
'group' => 'network',
|
||||
'type' => 'integer',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
18 =>
|
||||
array (
|
||||
'id' => 21,
|
||||
'key' => 'enable_ssl_pinning',
|
||||
'value' => 'false',
|
||||
'group' => 'network',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
19 =>
|
||||
array (
|
||||
'id' => 22,
|
||||
'key' => 'environment_selector',
|
||||
'value' => 'development',
|
||||
'group' => 'network',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
20 =>
|
||||
array (
|
||||
'id' => 23,
|
||||
'key' => 'api_version',
|
||||
'value' => 'v1',
|
||||
'group' => 'network',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
21 =>
|
||||
array (
|
||||
'id' => 24,
|
||||
'key' => 'request_cache_ttl',
|
||||
'value' => '3600',
|
||||
'group' => 'network',
|
||||
'type' => 'integer',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
22 =>
|
||||
array (
|
||||
'id' => 25,
|
||||
'key' => 'token_ttl_minutes',
|
||||
'value' => '43200',
|
||||
'group' => 'auth',
|
||||
'type' => 'integer',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
23 =>
|
||||
array (
|
||||
'id' => 26,
|
||||
'key' => 'session_max_age',
|
||||
'value' => '86400',
|
||||
'group' => 'auth',
|
||||
'type' => 'integer',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
24 =>
|
||||
array (
|
||||
'id' => 28,
|
||||
'key' => 'oauth_google_enabled',
|
||||
'value' => 'false',
|
||||
'group' => 'auth',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
25 =>
|
||||
array (
|
||||
'id' => 29,
|
||||
'key' => 'oauth_apple_enabled',
|
||||
'value' => 'false',
|
||||
'group' => 'auth',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
26 =>
|
||||
array (
|
||||
'id' => 30,
|
||||
'key' => 'login_max_attempts',
|
||||
'value' => '5',
|
||||
'group' => 'auth',
|
||||
'type' => 'integer',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
27 =>
|
||||
array (
|
||||
'id' => 31,
|
||||
'key' => 'fcm_topic_default',
|
||||
'value' => 'all_users',
|
||||
'group' => 'notification',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
28 =>
|
||||
array (
|
||||
'id' => 32,
|
||||
'key' => 'default_channel_id',
|
||||
'value' => 'general',
|
||||
'group' => 'notification',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
29 =>
|
||||
array (
|
||||
'id' => 33,
|
||||
'key' => 'notification_sound_enabled',
|
||||
'value' => 'true',
|
||||
'group' => 'notification',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
30 =>
|
||||
array (
|
||||
'id' => 34,
|
||||
'key' => 'badge_count_enabled',
|
||||
'value' => 'true',
|
||||
'group' => 'notification',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
31 =>
|
||||
array (
|
||||
'id' => 35,
|
||||
'key' => 'priority_level',
|
||||
'value' => 'high',
|
||||
'group' => 'notification',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
32 =>
|
||||
array (
|
||||
'id' => 36,
|
||||
'key' => 'sync_interval_ms',
|
||||
'value' => '10000',
|
||||
'group' => 'system',
|
||||
'type' => 'integer',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
33 =>
|
||||
array (
|
||||
'id' => 37,
|
||||
'key' => 'min_app_version',
|
||||
'value' => '1.0.0',
|
||||
'group' => 'system',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
34 =>
|
||||
array (
|
||||
'id' => 38,
|
||||
'key' => 'target_sdk_version',
|
||||
'value' => '34',
|
||||
'group' => 'system',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
35 =>
|
||||
array (
|
||||
'id' => 39,
|
||||
'key' => 'system_timezone',
|
||||
'value' => 'Asia/Jakarta',
|
||||
'group' => 'system',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
36 =>
|
||||
array (
|
||||
'id' => 40,
|
||||
'key' => 'google_analytics_id',
|
||||
'value' => 'G-BII-2026-X',
|
||||
'group' => 'system',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
37 =>
|
||||
array (
|
||||
'id' => 41,
|
||||
'key' => 'default_locale',
|
||||
'value' => 'en',
|
||||
'group' => 'system',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
38 =>
|
||||
array (
|
||||
'id' => 42,
|
||||
'key' => 'privacy_policy_url',
|
||||
'value' => 'https://biiproject.com/privacy',
|
||||
'group' => 'system',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
39 =>
|
||||
array (
|
||||
'id' => 43,
|
||||
'key' => 'region_lock_enabled',
|
||||
'value' => 'false',
|
||||
'group' => 'system',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
40 =>
|
||||
array (
|
||||
'id' => 44,
|
||||
'key' => 'min_sdk_version',
|
||||
'value' => '21',
|
||||
'group' => 'system',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
41 =>
|
||||
array (
|
||||
'id' => 47,
|
||||
'key' => 'support_email',
|
||||
'value' => 'support@biiproject.com',
|
||||
'group' => 'support',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
42 =>
|
||||
array (
|
||||
'id' => 48,
|
||||
'key' => 'support_whatsapp',
|
||||
'value' => '628123456789',
|
||||
'group' => 'support',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
43 =>
|
||||
array (
|
||||
'id' => 51,
|
||||
'key' => 'crashlytics_enabled',
|
||||
'value' => 'true',
|
||||
'group' => 'analytics',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
44 =>
|
||||
array (
|
||||
'id' => 52,
|
||||
'key' => 'log_level',
|
||||
'value' => 'error',
|
||||
'group' => 'analytics',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
45 =>
|
||||
array (
|
||||
'id' => 53,
|
||||
'key' => 'event_sampling_rate',
|
||||
'value' => '1.0',
|
||||
'group' => 'analytics',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
46 =>
|
||||
array (
|
||||
'id' => 54,
|
||||
'key' => 'gdpr_compliance_enabled',
|
||||
'value' => 'false',
|
||||
'group' => 'analytics',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
),
|
||||
47 =>
|
||||
array (
|
||||
'id' => 55,
|
||||
'key' => 'app_tagline',
|
||||
'value' => 'Smart Solution for Your Business',
|
||||
'group' => 'branding',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
48 =>
|
||||
array (
|
||||
'id' => 57,
|
||||
'key' => 'maintenance_start_at',
|
||||
'value' => NULL,
|
||||
'group' => 'control_center',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
49 =>
|
||||
array (
|
||||
'id' => 58,
|
||||
'key' => 'maintenance_end_at',
|
||||
'value' => NULL,
|
||||
'group' => 'control_center',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
50 =>
|
||||
array (
|
||||
'id' => 59,
|
||||
'key' => 'maintenance_bypass_ips',
|
||||
'value' => '127.0.0.1',
|
||||
'group' => 'control_center',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
51 =>
|
||||
array (
|
||||
'id' => 60,
|
||||
'key' => 'announcement_text',
|
||||
'value' => 'Maintenance is scheduled for tonight at 12:00 AM.',
|
||||
'group' => 'control_center',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
52 =>
|
||||
array (
|
||||
'id' => 61,
|
||||
'key' => 'announcement_type',
|
||||
'value' => 'info',
|
||||
'group' => 'control_center',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
53 =>
|
||||
array (
|
||||
'id' => 62,
|
||||
'key' => 'onboarding_version',
|
||||
'value' => '1.0.0',
|
||||
'group' => 'app_updates',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
54 =>
|
||||
array (
|
||||
'id' => 63,
|
||||
'key' => 'store_url_huawei',
|
||||
'value' => 'https://appgallery.huawei.com/',
|
||||
'group' => 'app_updates',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
55 =>
|
||||
array (
|
||||
'id' => 64,
|
||||
'key' => 'review_prompt_enabled',
|
||||
'value' => 'true',
|
||||
'group' => 'features',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
56 =>
|
||||
array (
|
||||
'id' => 65,
|
||||
'key' => 'min_actions_before_review',
|
||||
'value' => '10',
|
||||
'group' => 'features',
|
||||
'type' => 'integer',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
57 =>
|
||||
array (
|
||||
'id' => 66,
|
||||
'key' => 'dashboard_categories',
|
||||
'value' => 'All,Tech,Finance,Health,Coding',
|
||||
'group' => 'features',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
58 =>
|
||||
array (
|
||||
'id' => 67,
|
||||
'key' => 'login_title',
|
||||
'value' => 'biiproject',
|
||||
'group' => 'security_auth',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
59 =>
|
||||
array (
|
||||
'id' => 56,
|
||||
'key' => 'kill_switch_message',
|
||||
'value' => '<p>System is currently undergoing emergency maintenance. Please try again laters</p>',
|
||||
'group' => 'control_center',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:16:11',
|
||||
),
|
||||
60 =>
|
||||
array (
|
||||
'id' => 18,
|
||||
'key' => 'api_base_url',
|
||||
'value' => 'http://192.168.81.59:8000',
|
||||
'group' => 'network',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-13 16:23:15',
|
||||
),
|
||||
61 =>
|
||||
array (
|
||||
'id' => 14,
|
||||
'key' => 'kill_switch_active',
|
||||
'value' => 'false',
|
||||
'group' => 'flags',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-14 11:23:15',
|
||||
),
|
||||
62 =>
|
||||
array (
|
||||
'id' => 68,
|
||||
'key' => 'login_subtitle',
|
||||
'value' => 'Sign in to continue',
|
||||
'group' => 'security_auth',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
63 =>
|
||||
array (
|
||||
'id' => 27,
|
||||
'key' => 'biometric_auth_type',
|
||||
'value' => 'any',
|
||||
'group' => 'auth',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
64 =>
|
||||
array (
|
||||
'id' => 69,
|
||||
'key' => 'ssl_pinning_hash',
|
||||
'value' => NULL,
|
||||
'group' => 'connectivity',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
65 =>
|
||||
array (
|
||||
'id' => 49,
|
||||
'key' => 'live_chat_url',
|
||||
'value' => NULL,
|
||||
'group' => 'support',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
66 =>
|
||||
array (
|
||||
'id' => 50,
|
||||
'key' => 'faq_url',
|
||||
'value' => NULL,
|
||||
'group' => 'support',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
67 =>
|
||||
array (
|
||||
'id' => 45,
|
||||
'key' => 'social_instagram_url',
|
||||
'value' => NULL,
|
||||
'group' => 'support',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
68 =>
|
||||
array (
|
||||
'id' => 46,
|
||||
'key' => 'social_twitter_url',
|
||||
'value' => NULL,
|
||||
'group' => 'support',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
69 =>
|
||||
array (
|
||||
'id' => 70,
|
||||
'key' => 'social_facebook_url',
|
||||
'value' => NULL,
|
||||
'group' => 'support_social',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
70 =>
|
||||
array (
|
||||
'id' => 71,
|
||||
'key' => 'social_youtube_url',
|
||||
'value' => NULL,
|
||||
'group' => 'support_social',
|
||||
'type' => 'string',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
71 =>
|
||||
array (
|
||||
'id' => 72,
|
||||
'key' => 'faq_json',
|
||||
'value' => '[{"q":"How to sync?","a":"Click the sync button on dashboard."}]',
|
||||
'group' => 'support_social',
|
||||
'type' => 'json',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
72 =>
|
||||
array (
|
||||
'id' => 73,
|
||||
'key' => 'help_topics_json',
|
||||
'value' => '[{"id":"1","name":"Account","icon":"user"},{"id":"2","name":"System","icon":"cpu"}]',
|
||||
'group' => 'support_social',
|
||||
'type' => 'json',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
73 =>
|
||||
array (
|
||||
'id' => 74,
|
||||
'key' => 'announcement_enabled',
|
||||
'value' => 'false',
|
||||
'group' => 'control_center',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
74 =>
|
||||
array (
|
||||
'id' => 75,
|
||||
'key' => 'enable_guest_mode',
|
||||
'value' => 'false',
|
||||
'group' => 'features',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
75 =>
|
||||
array (
|
||||
'id' => 76,
|
||||
'key' => 'oauth_facebook_enabled',
|
||||
'value' => 'false',
|
||||
'group' => 'security_auth',
|
||||
'type' => 'boolean',
|
||||
'created_at' => '2026-05-12 22:15:47',
|
||||
'updated_at' => '2026-05-12 22:15:47',
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ModelHasPermissionsTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/**
|
||||
* Auto generated seed file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
|
||||
\DB::table('model_has_permissions')->delete();
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,50 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class ModelHasRolesTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/**
|
||||
* Auto generated seed file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
|
||||
\DB::table('model_has_roles')->delete();
|
||||
|
||||
\DB::table('model_has_roles')->insert(array (
|
||||
0 =>
|
||||
array (
|
||||
'role_id' => 2,
|
||||
'model_type' => 'App\\Models\\User',
|
||||
'model_id' => 1,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'role_id' => 1,
|
||||
'model_type' => 'App\\Models\\User',
|
||||
'model_id' => 2,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'role_id' => 3,
|
||||
'model_type' => 'App\\Models\\User',
|
||||
'model_id' => 3,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'role_id' => 1,
|
||||
'model_type' => 'App\\Models\\User',
|
||||
'model_id' => 5,
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,350 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class PermissionsTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/**
|
||||
* Auto generated seed file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
|
||||
\DB::table('permissions')->delete();
|
||||
|
||||
\DB::table('permissions')->insert(array (
|
||||
0 =>
|
||||
array (
|
||||
'id' => 1,
|
||||
'name' => 'view dashboard',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'id' => 2,
|
||||
'name' => 'view user directory',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'id' => 3,
|
||||
'name' => 'manage user directory',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'id' => 4,
|
||||
'name' => 'impersonate users',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'id' => 5,
|
||||
'name' => 'view access rights',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'id' => 6,
|
||||
'name' => 'manage access rights',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'id' => 7,
|
||||
'name' => 'view health and logs',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
7 =>
|
||||
array (
|
||||
'id' => 8,
|
||||
'name' => 'manage health and logs',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
8 =>
|
||||
array (
|
||||
'id' => 9,
|
||||
'name' => 'view system health',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
9 =>
|
||||
array (
|
||||
'id' => 10,
|
||||
'name' => 'manage system health',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
10 =>
|
||||
array (
|
||||
'id' => 11,
|
||||
'name' => 'view action history',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
11 =>
|
||||
array (
|
||||
'id' => 12,
|
||||
'name' => 'manage action history',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
12 =>
|
||||
array (
|
||||
'id' => 13,
|
||||
'name' => 'view pulse',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
13 =>
|
||||
array (
|
||||
'id' => 14,
|
||||
'name' => 'view telescope',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
14 =>
|
||||
array (
|
||||
'id' => 15,
|
||||
'name' => 'view api docs',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
15 =>
|
||||
array (
|
||||
'id' => 16,
|
||||
'name' => 'view active sessions',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
16 =>
|
||||
array (
|
||||
'id' => 17,
|
||||
'name' => 'manage active sessions',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
17 =>
|
||||
array (
|
||||
'id' => 18,
|
||||
'name' => 'view global settings',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
18 =>
|
||||
array (
|
||||
'id' => 19,
|
||||
'name' => 'manage global settings',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
19 =>
|
||||
array (
|
||||
'id' => 20,
|
||||
'name' => 'view maintenance mode',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
20 =>
|
||||
array (
|
||||
'id' => 21,
|
||||
'name' => 'manage maintenance mode',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
21 =>
|
||||
array (
|
||||
'id' => 22,
|
||||
'name' => 'view backup and storage',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
22 =>
|
||||
array (
|
||||
'id' => 23,
|
||||
'name' => 'manage backup and storage',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
23 =>
|
||||
array (
|
||||
'id' => 24,
|
||||
'name' => 'view mobile settings',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:12',
|
||||
'updated_at' => '2026-05-12 22:01:12',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
24 =>
|
||||
array (
|
||||
'id' => 25,
|
||||
'name' => 'manage mobile settings',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:13',
|
||||
'updated_at' => '2026-05-12 22:01:13',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
25 =>
|
||||
array (
|
||||
'id' => 26,
|
||||
'name' => 'view notification center',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:13',
|
||||
'updated_at' => '2026-05-12 22:01:13',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
26 =>
|
||||
array (
|
||||
'id' => 27,
|
||||
'name' => 'manage notification center',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:13',
|
||||
'updated_at' => '2026-05-12 22:01:13',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Spatie\Permission\Models\Permission;
|
||||
use Spatie\Permission\Models\Role;
|
||||
use Spatie\Permission\PermissionRegistrar;
|
||||
|
||||
class RoleAndPermissionSeeder extends Seeder
|
||||
{
|
||||
public function run(): void
|
||||
{
|
||||
app()[PermissionRegistrar::class]->forgetCachedPermissions();
|
||||
|
||||
// ── MENU-LEVEL PERMISSIONS (scope = null) ─────────────────────────────
|
||||
$menuPermissions = [
|
||||
'view dashboard',
|
||||
'view user directory', 'manage user directory',
|
||||
'impersonate users',
|
||||
'view access rights', 'manage access rights',
|
||||
'view health and logs', 'manage health and logs',
|
||||
'view system health', 'manage system health',
|
||||
'view action history', 'manage action history',
|
||||
'view pulse', 'view telescope', 'view api docs',
|
||||
'view active sessions', 'manage active sessions',
|
||||
'view global settings', 'manage global settings',
|
||||
'view maintenance mode', 'manage maintenance mode',
|
||||
'view backup and storage', 'manage backup and storage',
|
||||
'view mobile settings', 'manage mobile settings',
|
||||
'view notification center', 'manage notification center',
|
||||
'view ai self-healing', 'manage ai self-healing',
|
||||
'view ai log analysis', 'use ai assistant',
|
||||
];
|
||||
|
||||
foreach ($menuPermissions as $name) {
|
||||
Permission::firstOrCreate(
|
||||
['name' => $name, 'guard_name' => 'web'],
|
||||
['scope' => null, 'is_active' => true]
|
||||
);
|
||||
}
|
||||
|
||||
// ── TAB-LEVEL PERMISSIONS [name, scope] ───────────────────────────────
|
||||
$tabPermissions = [
|
||||
// Global Settings
|
||||
['view global settings:general', 'general'],
|
||||
['manage global settings:general', 'general'],
|
||||
['view global settings:login-security', 'login-security'],
|
||||
['manage global settings:login-security', 'login-security'],
|
||||
['view global settings:password-policy', 'password-policy'],
|
||||
['manage global settings:password-policy', 'password-policy'],
|
||||
['view global settings:social-login', 'social-login'],
|
||||
['manage global settings:social-login', 'social-login'],
|
||||
['view global settings:ip-access', 'ip-access'],
|
||||
['manage global settings:ip-access', 'ip-access'],
|
||||
['view global settings:notifications', 'notifications'],
|
||||
['manage global settings:notifications', 'notifications'],
|
||||
['view global settings:content-legal', 'content-legal'],
|
||||
['manage global settings:content-legal', 'content-legal'],
|
||||
['view global settings:ai-config', 'ai-config'],
|
||||
['manage global settings:ai-config', 'ai-config'],
|
||||
['view global settings:sap-integration', 'sap-integration'],
|
||||
['manage global settings:sap-integration', 'sap-integration'],
|
||||
['view global settings:monitoring', 'monitoring'],
|
||||
['manage global settings:monitoring', 'monitoring'],
|
||||
// Mobile Settings
|
||||
['view mobile settings:branding', 'branding'],
|
||||
['manage mobile settings:branding', 'branding'],
|
||||
['view mobile settings:control-center', 'control-center'],
|
||||
['manage mobile settings:control-center', 'control-center'],
|
||||
['view mobile settings:app-updates', 'app-updates'],
|
||||
['manage mobile settings:app-updates', 'app-updates'],
|
||||
['view mobile settings:features', 'features'],
|
||||
['manage mobile settings:features', 'features'],
|
||||
['view mobile settings:security-auth', 'security-auth'],
|
||||
['manage mobile settings:security-auth', 'security-auth'],
|
||||
['view mobile settings:connectivity', 'connectivity'],
|
||||
['manage mobile settings:connectivity', 'connectivity'],
|
||||
['view mobile settings:notifications', 'notifications'],
|
||||
['manage mobile settings:notifications', 'notifications'],
|
||||
['view mobile settings:support-social', 'support-social'],
|
||||
['manage mobile settings:support-social', 'support-social'],
|
||||
['view mobile settings:analytics-system', 'analytics-system'],
|
||||
['manage mobile settings:analytics-system','analytics-system'],
|
||||
['view mobile settings:localization', 'localization'],
|
||||
['manage mobile settings:localization', 'localization'],
|
||||
['view mobile settings:developer', 'developer'],
|
||||
['manage mobile settings:developer', 'developer'],
|
||||
// Health & Logs
|
||||
['view health and logs:system-monitor', 'system-monitor'],
|
||||
['manage health and logs:system-monitor', 'system-monitor'],
|
||||
['view health and logs:ai-log-analysis', 'ai-log-analysis'],
|
||||
['view health and logs:error-logs', 'error-logs'],
|
||||
['manage health and logs:error-logs', 'error-logs'],
|
||||
['view health and logs:query-logs', 'query-logs'],
|
||||
['manage health and logs:query-logs', 'query-logs'],
|
||||
// Action History
|
||||
['view action history:all', 'all'],
|
||||
['view action history:own', 'own'],
|
||||
['export action history', null],
|
||||
// Active Sessions
|
||||
['view active sessions:all', 'all'],
|
||||
['view active sessions:own', 'own'],
|
||||
];
|
||||
|
||||
foreach ($tabPermissions as [$name, $scope]) {
|
||||
Permission::firstOrCreate(
|
||||
['name' => $name, 'guard_name' => 'web'],
|
||||
['scope' => $scope, 'is_active' => true]
|
||||
);
|
||||
}
|
||||
|
||||
// ── ROLES ─────────────────────────────────────────────────────────────
|
||||
$developer = Role::findOrCreate('Developer', 'web');
|
||||
$developer->syncPermissions(Permission::where('guard_name', 'web')->get());
|
||||
|
||||
$globalTabPerms = array_column(
|
||||
array_filter($tabPermissions, fn ($p) => str_contains($p[0], 'global settings:')), 0
|
||||
);
|
||||
$mobileTabPerms = array_column(
|
||||
array_filter($tabPermissions, fn ($p) => str_contains($p[0], 'mobile settings:')), 0
|
||||
);
|
||||
$healthTabPerms = array_column(
|
||||
array_filter($tabPermissions, fn ($p) => str_contains($p[0], 'health and logs:')), 0
|
||||
);
|
||||
|
||||
$administrator = Role::findOrCreate('Administrator', 'web');
|
||||
$administrator->syncPermissions(array_merge([
|
||||
'view dashboard',
|
||||
'view user directory', 'manage user directory',
|
||||
'impersonate users',
|
||||
'view mobile settings', 'manage mobile settings',
|
||||
'view notification center', 'manage notification center',
|
||||
'view global settings', 'manage global settings',
|
||||
'view health and logs', 'manage health and logs',
|
||||
'view action history', 'manage action history',
|
||||
'export action history',
|
||||
'view active sessions', 'manage active sessions',
|
||||
], $globalTabPerms, $mobileTabPerms, $healthTabPerms));
|
||||
|
||||
$user = Role::findOrCreate('User', 'web');
|
||||
$user->syncPermissions(['view dashboard', 'view notification center']);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class RoleHasPermissionsTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/**
|
||||
* Auto generated seed file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
|
||||
\DB::table('role_has_permissions')->delete();
|
||||
|
||||
\DB::table('role_has_permissions')->insert(array (
|
||||
0 =>
|
||||
array (
|
||||
'permission_id' => 1,
|
||||
'role_id' => 1,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'permission_id' => 2,
|
||||
'role_id' => 1,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'permission_id' => 3,
|
||||
'role_id' => 1,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'permission_id' => 4,
|
||||
'role_id' => 1,
|
||||
),
|
||||
4 =>
|
||||
array (
|
||||
'permission_id' => 5,
|
||||
'role_id' => 1,
|
||||
),
|
||||
5 =>
|
||||
array (
|
||||
'permission_id' => 6,
|
||||
'role_id' => 1,
|
||||
),
|
||||
6 =>
|
||||
array (
|
||||
'permission_id' => 7,
|
||||
'role_id' => 1,
|
||||
),
|
||||
7 =>
|
||||
array (
|
||||
'permission_id' => 8,
|
||||
'role_id' => 1,
|
||||
),
|
||||
8 =>
|
||||
array (
|
||||
'permission_id' => 9,
|
||||
'role_id' => 1,
|
||||
),
|
||||
9 =>
|
||||
array (
|
||||
'permission_id' => 10,
|
||||
'role_id' => 1,
|
||||
),
|
||||
10 =>
|
||||
array (
|
||||
'permission_id' => 11,
|
||||
'role_id' => 1,
|
||||
),
|
||||
11 =>
|
||||
array (
|
||||
'permission_id' => 12,
|
||||
'role_id' => 1,
|
||||
),
|
||||
12 =>
|
||||
array (
|
||||
'permission_id' => 13,
|
||||
'role_id' => 1,
|
||||
),
|
||||
13 =>
|
||||
array (
|
||||
'permission_id' => 14,
|
||||
'role_id' => 1,
|
||||
),
|
||||
14 =>
|
||||
array (
|
||||
'permission_id' => 15,
|
||||
'role_id' => 1,
|
||||
),
|
||||
15 =>
|
||||
array (
|
||||
'permission_id' => 16,
|
||||
'role_id' => 1,
|
||||
),
|
||||
16 =>
|
||||
array (
|
||||
'permission_id' => 17,
|
||||
'role_id' => 1,
|
||||
),
|
||||
17 =>
|
||||
array (
|
||||
'permission_id' => 18,
|
||||
'role_id' => 1,
|
||||
),
|
||||
18 =>
|
||||
array (
|
||||
'permission_id' => 19,
|
||||
'role_id' => 1,
|
||||
),
|
||||
19 =>
|
||||
array (
|
||||
'permission_id' => 20,
|
||||
'role_id' => 1,
|
||||
),
|
||||
20 =>
|
||||
array (
|
||||
'permission_id' => 21,
|
||||
'role_id' => 1,
|
||||
),
|
||||
21 =>
|
||||
array (
|
||||
'permission_id' => 22,
|
||||
'role_id' => 1,
|
||||
),
|
||||
22 =>
|
||||
array (
|
||||
'permission_id' => 23,
|
||||
'role_id' => 1,
|
||||
),
|
||||
23 =>
|
||||
array (
|
||||
'permission_id' => 24,
|
||||
'role_id' => 1,
|
||||
),
|
||||
24 =>
|
||||
array (
|
||||
'permission_id' => 25,
|
||||
'role_id' => 1,
|
||||
),
|
||||
25 =>
|
||||
array (
|
||||
'permission_id' => 26,
|
||||
'role_id' => 1,
|
||||
),
|
||||
26 =>
|
||||
array (
|
||||
'permission_id' => 27,
|
||||
'role_id' => 1,
|
||||
),
|
||||
27 =>
|
||||
array (
|
||||
'permission_id' => 1,
|
||||
'role_id' => 3,
|
||||
),
|
||||
28 =>
|
||||
array (
|
||||
'permission_id' => 26,
|
||||
'role_id' => 3,
|
||||
),
|
||||
29 =>
|
||||
array (
|
||||
'permission_id' => 1,
|
||||
'role_id' => 2,
|
||||
),
|
||||
30 =>
|
||||
array (
|
||||
'permission_id' => 2,
|
||||
'role_id' => 2,
|
||||
),
|
||||
31 =>
|
||||
array (
|
||||
'permission_id' => 3,
|
||||
'role_id' => 2,
|
||||
),
|
||||
32 =>
|
||||
array (
|
||||
'permission_id' => 4,
|
||||
'role_id' => 2,
|
||||
),
|
||||
33 =>
|
||||
array (
|
||||
'permission_id' => 5,
|
||||
'role_id' => 2,
|
||||
),
|
||||
34 =>
|
||||
array (
|
||||
'permission_id' => 6,
|
||||
'role_id' => 2,
|
||||
),
|
||||
35 =>
|
||||
array (
|
||||
'permission_id' => 26,
|
||||
'role_id' => 2,
|
||||
),
|
||||
36 =>
|
||||
array (
|
||||
'permission_id' => 27,
|
||||
'role_id' => 2,
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class RolesTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/**
|
||||
* Auto generated seed file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
|
||||
\DB::table('roles')->delete();
|
||||
|
||||
\DB::table('roles')->insert(array (
|
||||
0 =>
|
||||
array (
|
||||
'id' => 1,
|
||||
'name' => 'Developer',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:13',
|
||||
'updated_at' => '2026-05-12 22:01:13',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'id' => 3,
|
||||
'name' => 'User',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:13',
|
||||
'updated_at' => '2026-05-12 22:01:13',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'id' => 2,
|
||||
'name' => 'Administrator',
|
||||
'guard_name' => 'web',
|
||||
'created_at' => '2026-05-12 22:01:13',
|
||||
'updated_at' => '2026-05-12 22:02:18',
|
||||
'created_by' => NULL,
|
||||
'updated_by' => 2,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
|
||||
class UsersTableSeeder extends Seeder
|
||||
{
|
||||
|
||||
/**
|
||||
* Auto generated seed file
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function run()
|
||||
{
|
||||
|
||||
|
||||
\DB::table('users')->delete();
|
||||
|
||||
\DB::table('users')->insert(array (
|
||||
0 =>
|
||||
array (
|
||||
'id' => 1,
|
||||
'name' => 'Admin',
|
||||
'email' => 'admin@biiproject.com',
|
||||
'email_verified_at' => '2026-05-12 22:01:14',
|
||||
'password' => '$2y$12$b3xJdw.sj00MbqWychUNEuOS/ZYL8Hp8suXrtAsBIW6bmzqTBQZES',
|
||||
'remember_token' => NULL,
|
||||
'created_at' => '2026-05-12 22:01:14',
|
||||
'updated_at' => '2026-05-12 22:01:14',
|
||||
'password_changed_at' => NULL,
|
||||
'username' => NULL,
|
||||
'phone_number' => NULL,
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
'last_session_id' => NULL,
|
||||
'google_id' => NULL,
|
||||
'facebook_id' => NULL,
|
||||
'github_id' => NULL,
|
||||
),
|
||||
1 =>
|
||||
array (
|
||||
'id' => 3,
|
||||
'name' => 'User',
|
||||
'email' => 'user@biiproject.com',
|
||||
'email_verified_at' => '2026-05-12 22:01:15',
|
||||
'password' => '$2y$12$bKXz5NL0DE5P0HLbooNQU.sLWt21qAD08Pw.m75pX3i69xvgbxhRu',
|
||||
'remember_token' => NULL,
|
||||
'created_at' => '2026-05-12 22:01:15',
|
||||
'updated_at' => '2026-05-13 16:08:00',
|
||||
'password_changed_at' => NULL,
|
||||
'username' => NULL,
|
||||
'phone_number' => NULL,
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
'last_session_id' => NULL,
|
||||
'google_id' => NULL,
|
||||
'facebook_id' => NULL,
|
||||
'github_id' => NULL,
|
||||
),
|
||||
2 =>
|
||||
array (
|
||||
'id' => 2,
|
||||
'name' => 'Developer',
|
||||
'email' => 'developer@biiproject.com',
|
||||
'email_verified_at' => '2026-05-12 22:01:15',
|
||||
'password' => '$2y$12$6O6erPgiw75ivUASdm95tOEHBG4bCnRjxIygFHH3IPf4EJkVokqrK',
|
||||
'remember_token' => NULL,
|
||||
'created_at' => '2026-05-12 22:01:15',
|
||||
'updated_at' => '2026-05-14 22:57:49',
|
||||
'password_changed_at' => NULL,
|
||||
'username' => NULL,
|
||||
'phone_number' => NULL,
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
'last_session_id' => 'AFghrj0VNIgvVm1q5pJn0U1x0TnJwX30srp3yKp9',
|
||||
'google_id' => NULL,
|
||||
'facebook_id' => NULL,
|
||||
'github_id' => NULL,
|
||||
),
|
||||
3 =>
|
||||
array (
|
||||
'id' => 5,
|
||||
'name' => 'Debe',
|
||||
'email' => 'debesocial@gmail.com',
|
||||
'email_verified_at' => '2026-05-14 23:20:40',
|
||||
'password' => '$2y$12$LQ1wN1Ws28SmKvZuSG.JdOHBp5FscKsKrXy3V5pO5zPDnBymU2Yku',
|
||||
'remember_token' => 'Bp4HtFWjgAL4Xt9oBqxrCMfE8zQjDBD7ErGwvHDIY3nKNOPdtItItfsyrVkt',
|
||||
'created_at' => '2026-05-14 23:20:23',
|
||||
'updated_at' => '2026-05-14 23:22:44',
|
||||
'password_changed_at' => '2026-05-14 23:20:40',
|
||||
'username' => 'Debe',
|
||||
'phone_number' => NULL,
|
||||
'created_by' => NULL,
|
||||
'updated_by' => NULL,
|
||||
'deleted_at' => NULL,
|
||||
'is_active' => true,
|
||||
'last_session_id' => NULL,
|
||||
'google_id' => NULL,
|
||||
'facebook_id' => NULL,
|
||||
'github_id' => NULL,
|
||||
),
|
||||
));
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user