first commit

This commit is contained in:
2025-03-07 00:29:07 -06:00
commit b21a11c2ee
564 changed files with 94041 additions and 0 deletions

View File

@ -0,0 +1,510 @@
{
"roles": {
"SuperAdmin" : {
"style": "dark",
"permissions" : [
"admin.core.general-settings.allow",
"admin.core.cache-manager.view",
"admin.core.smtp-settings.allow",
"admin.store-manager.company.view",
"admin.store-manager.stores.view",
"admin.store-manager.stores.view",
"admin.finance.banxico.allow",
"admin.finance.banking.allow",
"admin.sales.ticket-config.allow",
"admin.billing.csds-settings.allow",
"admin.billing.stamping-package.allow",
"admin.billing.smtp-settings.allow",
"admin.billing.mass-cfdi-download.allow",
"admin.core.users.view",
"admin.core.roles.view",
"admin.core.permissions.view",
"admin.core.import-sat-catalogs.allow",
"admin.ai.dashboard.view",
"admin.ai.content.create",
"admin.ai.analytics.view",
"admin.chatbot.config.view",
"admin.chatbot.flows.manage",
"admin.chatbot.history.view",
"admin.iot.devices.view",
"admin.iot.sensors.manage",
"admin.iot.monitoring.view",
"admin.facial-recognition.profiles.manage",
"admin.facial-recognition.live.verify",
"admin.facial-recognition.history.view",
"admin.print.queue.view",
"admin.print.history.view",
"admin.print.settings.manage",
"admin.website.general-settings.allow",
"admin.website.legal.view",
"admin.website.faq.view",
"admin.blog.categories.view",
"admin.blog.tags.view",
"admin.blog.articles.view",
"admin.blog.comments.view",
"admin.contacts.contacts.view",
"admin.contacts.employees.view",
"admin.contacts.employees.create",
"admin.rrhh.jobs.view",
"admin.rrhh.organization.view",
"admin.recruitment.jobs.view",
"admin.recruitment.candidates.view",
"admin.recruitment.interviews.view",
"admin.payroll.contracts.view",
"admin.payroll.process.view",
"admin.payroll.receipts.view",
"admin.payroll.reports.view",
"admin.attendance.records.view",
"admin.attendance.biometric.view",
"admin.attendance.absences.view",
"admin.inventory.product-categories.view",
"admin.inventory.product-catalogs.view",
"admin.inventory.products.view",
"admin.inventory.products.create",
"admin.sales.dashboard.allow",
"admin.contacts.customers.view",
"admin.sales.sales.view",
"admin.sales.quotes.view",
"admin.sales.sales.create",
"admin.sales.sales.view",
"admin.sales.sales.view",
"admin.sales.remissions.create",
"admin.sales.remissions.view",
"admin.sales.remissions.view",
"admin.sales.credit-notes.create",
"admin.sales.credit-notes.view",
"admin.sales.credit-notes.view",
"admin.accounting.dashboard.view",
"admin.accounting.charts.view",
"admin.finance.accounts-payable.view",
"admin.finance.accounts-receivable.view",
"admin.accounting.balance.view",
"admin.accounting.income-statement.view",
"admin.accounting.ledger.view",
"admin.accounting.entries.view",
"admin.expenses.dashboard.view",
"admin.expenses.expenses.create",
"admin.expenses.expenses.view",
"admin.expenses.categories.view",
"admin.expenses.history.view",
"admin.billing.dashboard.allow",
"admin.billing.ingresos.create",
"admin.billing.ingresos.view",
"admin.billing.ingresos.view",
"admin.billing.egresos.create",
"admin.billing.egresos.view",
"admin.billing.egresos.view",
"admin.billing.pagos.created",
"admin.billing.pagos.view",
"admin.billing.nomina.view",
"admin.billing.verify-cfdi.allow",
"admin.contacts.suppliers.view",
"admin.inventory.orders.view",
"admin.inventory.reception.view",
"admin.inventory.materials.view",
"admin.inventory.warehouse.view",
"admin.inventory.stock.view",
"admin.inventory.movements.view",
"admin.inventory.transfers.view",
"admin.inventory.shipping-orders.view",
"admin.inventory.shipping-tracking.view",
"admin.inventory.shipping-carriers.view",
"admin.inventory.shipping-rates.view",
"admin.inventory.assets.view",
"admin.inventory.asset-maintenance.view",
"admin.inventory.asset-lifecycle.view",
"admin.inventory.asset-assignments.view",
"admin.projects.dashboard.view",
"admin.projects.view",
"admin.projects.create",
"admin.projects.tasks.view",
"admin.projects.history.view",
"admin.production.orders.view",
"admin.production.orders.create",
"admin.production.process.view",
"admin.production.history.view",
"admin.quality.inspections.view",
"admin.quality.inspections.create",
"admin.quality.reports.view",
"admin.quality.history.view",
"admin.workflows.view",
"admin.workflows.create",
"admin.workflows.automations.view",
"admin.workflows.history.view",
"admin.contracts.view",
"admin.contracts.sign",
"admin.contracts.automated.view",
"admin.contracts.history.view",
"admin.ticketing.dashboard.view",
"admin.ticketing.tickets.view",
"admin.ticketing.tickets.create",
"admin.ticketing.categories.view",
"admin.ticketing.analytics.view"
]
},
"Admin" : {
"style": "primary",
"permissions" : [
"admin.core.general-settings.allow",
"admin.core.cache-manager.view",
"admin.core.smtp-settings.allow",
"admin.website.general-settings.allow",
"admin.website.legal.view",
"admin.store-manager.company.view",
"admin.store-manager.stores.view",
"admin.store-manager.stores.view",
"admin.core.users.view",
"admin.core.roles.view",
"admin.core.permissions.view",
"admin.core.import-sat-catalogs.allow",
"admin.contacts.contacts.view",
"admin.contacts.contacts.create",
"admin.contacts.employees.view",
"admin.contacts.employees.create",
"admin.contacts.customers.view",
"admin.contacts.customers.create",
"admin.rrhh.jobs.view",
"admin.rrhh.organization.view",
"admin.inventory.product-categories.view",
"admin.inventory.product-catalogs.view",
"admin.inventory.products.view",
"admin.inventory.products.create",
"admin.contacts.suppliers.view",
"admin.contacts.suppliers.create",
"admin.inventory.warehouse.view",
"admin.inventory.orders.view",
"admin.inventory.reception.view",
"admin.inventory.materials.view",
"admin.inventory.stock.view",
"admin.inventory.movements.view",
"admin.inventory.transfers.view",
"admin.inventory.assets.view",
"admin.inventory.asset-maintenance.view",
"admin.inventory.asset-lifecycle.view",
"admin.inventory.asset-assignments.view"
]
},
"Administrador Web" : {
"style": "primary",
"permissions" : []
},
"Editor" : {
"style": "primary",
"permissions" : []
},
"Almacenista" : {
"style": "success",
"permissions" : [
"admin.inventory.product-categories.view",
"admin.inventory.product-catalogs.view",
"admin.inventory.products.view",
"admin.inventory.products.create",
"admin.inventory.warehouse.view",
"admin.inventory.stock.view",
"admin.inventory.movements.view",
"admin.inventory.transfers.view"
]
},
"Productos y servicios" : {
"style": "info",
"permissions" : []
},
"Recursos humanos" : {
"style": "success",
"permissions" : []
},
"Nómina" : {
"style": "success",
"permissions" : []
},
"Activos fijos" : {
"style": "secondary",
"permissions" : []
},
"Compras y gastos" : {
"style": "info",
"permissions" : []
},
"CRM" : {
"style": "warning",
"permissions" : []
},
"Vendedor" : {
"style": "info",
"permissions" : []
},
"Gerente" : {
"style": "danger",
"permissions" : []
},
"Facturación" : {
"style": "info",
"permissions" : []
},
"Facturación avanzado" : {
"style": "danger",
"permissions" : []
},
"Finanzas" : {
"style": "info",
"permissions" : []
},
"Auditor" : {
"style": "dark",
"permissions" : [
"admin.core.cache-manager.view",
"admin.store-manager.company.view",
"admin.store-manager.stores.view",
"admin.store-manager.stores.view",
"admin.core.users.view",
"admin.core.roles.view",
"admin.core.permissions.view",
"admin.ai.dashboard.view",
"admin.ai.analytics.view",
"admin.chatbot.config.view",
"admin.chatbot.history.view",
"admin.iot.devices.view",
"admin.iot.monitoring.view",
"admin.facial-recognition.history.view",
"admin.print.queue.view",
"admin.print.history.view",
"admin.website.legal.view",
"admin.website.faq.view",
"admin.blog.categories.view",
"admin.blog.tags.view",
"admin.blog.articles.view",
"admin.blog.comments.view",
"admin.contacts.contacts.view",
"admin.crm.marketing-campaigns.view",
"admin.crm.leads.view",
"admin.crm.newsletter.view",
"admin.contacts.employees.view",
"admin.rrhh.jobs.view",
"admin.rrhh.organization.view",
"admin.recruitment.jobs.view",
"admin.recruitment.candidates.view",
"admin.recruitment.interviews.view",
"admin.payroll.contracts.view",
"admin.payroll.process.view",
"admin.payroll.receipts.view",
"admin.payroll.reports.view",
"admin.attendance.records.view",
"admin.attendance.biometric.view",
"admin.attendance.absences.view",
"admin.inventory.product-categories.view",
"admin.inventory.product-catalogs.view",
"admin.inventory.products.view",
"admin.contacts.customers.view",
"admin.sales.sales.view",
"admin.sales.quotes.view",
"admin.sales.sales.view",
"admin.sales.sales.view",
"admin.sales.remissions.view",
"admin.sales.remissions.view",
"admin.sales.credit-notes.view",
"admin.sales.credit-notes.view",
"admin.accounting.dashboard.view",
"admin.accounting.charts.view",
"admin.finance.accounts-payable.view",
"admin.finance.accounts-receivable.view",
"admin.accounting.balance.view",
"admin.accounting.income-statement.view",
"admin.accounting.ledger.view",
"admin.accounting.entries.view",
"admin.expenses.dashboard.view",
"admin.expenses.expenses.view",
"admin.expenses.categories.view",
"admin.expenses.history.view",
"admin.billing.ingresos.view",
"admin.billing.ingresos.view",
"admin.billing.egresos.view",
"admin.billing.egresos.view",
"admin.billing.pagos.view",
"admin.billing.nomina.view",
"admin.contacts.suppliers.view",
"admin.inventory.orders.view",
"admin.inventory.reception.view",
"admin.inventory.materials.view",
"admin.inventory.warehouse.view",
"admin.inventory.stock.view",
"admin.inventory.movements.view",
"admin.inventory.transfers.view",
"admin.inventory.shipping-orders.view",
"admin.inventory.shipping-tracking.view",
"admin.inventory.shipping-carriers.view",
"admin.inventory.shipping-rates.view",
"admin.inventory.assets.view",
"admin.inventory.asset-maintenance.view",
"admin.inventory.asset-lifecycle.view",
"admin.inventory.asset-assignments.view",
"admin.projects.dashboard.view",
"admin.projects.view",
"admin.projects.tasks.view",
"admin.projects.history.view",
"admin.production.orders.view",
"admin.production.process.view",
"admin.production.history.view",
"admin.quality.inspections.view",
"admin.quality.reports.view",
"admin.quality.history.view",
"admin.workflows.view",
"admin.workflows.automations.view",
"admin.workflows.history.view",
"admin.contracts.view",
"admin.contracts.automated.view",
"admin.contracts.history.view",
"admin.ticketing.dashboard.view",
"admin.ticketing.tickets.view",
"admin.ticketing.categories.view",
"admin.ticketing.analytics.view"
]
}
},
"permissions": [
"admin.core.general-settings.allow",
"admin.core.cache-manager.view",
"admin.core.smtp-settings.allow",
"admin.store-manager.company.view",
"admin.store-manager.stores.view",
"admin.store-manager.stores.view",
"admin.finance.banxico.allow",
"admin.finance.banking.allow",
"admin.sales.ticket-config.allow",
"admin.billing.csds-settings.allow",
"admin.billing.stamping-package.allow",
"admin.billing.smtp-settings.allow",
"admin.billing.mass-cfdi-download.allow",
"admin.core.users.view",
"admin.core.roles.view",
"admin.core.permissions.view",
"admin.core.import-sat-catalogs.allow",
"admin.ai.dashboard.view",
"admin.ai.content.create",
"admin.ai.analytics.view",
"admin.chatbot.config.view",
"admin.chatbot.flows.manage",
"admin.chatbot.history.view",
"admin.iot.devices.view",
"admin.iot.sensors.manage",
"admin.iot.monitoring.view",
"admin.facial-recognition.profiles.manage",
"admin.facial-recognition.live.verify",
"admin.facial-recognition.history.view",
"admin.print.queue.view",
"admin.print.history.view",
"admin.print.settings.manage",
"admin.website.general-settings.allow",
"admin.website.legal.view",
"admin.website.faq.view",
"admin.blog.categories.view",
"admin.blog.tags.view",
"admin.blog.articles.view",
"admin.blog.comments.view",
"admin.contacts.contacts.view",
"admin.contacts.contacts.create",
"admin.crm.marketing-campaigns.view",
"admin.crm.leads.view",
"admin.crm.newsletter.view",
"admin.contacts.employees.view",
"admin.contacts.employees.create",
"admin.rrhh.jobs.view",
"admin.rrhh.organization.view",
"admin.recruitment.jobs.view",
"admin.recruitment.candidates.view",
"admin.recruitment.interviews.view",
"admin.payroll.contracts.view",
"admin.payroll.process.view",
"admin.payroll.receipts.view",
"admin.payroll.reports.view",
"admin.attendance.records.view",
"admin.attendance.biometric.view",
"admin.attendance.absences.view",
"admin.inventory.product-categories.view",
"admin.inventory.product-catalogs.view",
"admin.inventory.products.view",
"admin.inventory.products.create",
"admin.sales.dashboard.allow",
"admin.contacts.customers.view",
"admin.contacts.customers.create",
"admin.sales.sales.view",
"admin.sales.quotes.view",
"admin.sales.sales.create",
"admin.sales.sales.view",
"admin.sales.sales.view",
"admin.sales.remissions.create",
"admin.sales.remissions.view",
"admin.sales.remissions.view",
"admin.sales.credit-notes.create",
"admin.sales.credit-notes.view",
"admin.sales.credit-notes.view",
"admin.accounting.dashboard.view",
"admin.accounting.charts.view",
"admin.finance.accounts-payable.view",
"admin.finance.accounts-receivable.view",
"admin.accounting.balance.view",
"admin.accounting.income-statement.view",
"admin.accounting.ledger.view",
"admin.accounting.entries.view",
"admin.expenses.dashboard.view",
"admin.expenses.expenses.create",
"admin.expenses.expenses.view",
"admin.expenses.categories.view",
"admin.expenses.history.view",
"admin.billing.dashboard.allow",
"admin.billing.ingresos.create",
"admin.billing.ingresos.view",
"admin.billing.ingresos.view",
"admin.billing.egresos.create",
"admin.billing.egresos.view",
"admin.billing.egresos.view",
"admin.billing.pagos.created",
"admin.billing.pagos.view",
"admin.billing.nomina.view",
"admin.billing.verify-cfdi.allow",
"admin.contacts.suppliers.view",
"admin.contacts.suppliers.create",
"admin.inventory.orders.view",
"admin.inventory.reception.view",
"admin.inventory.materials.view",
"admin.inventory.warehouse.view",
"admin.inventory.stock.view",
"admin.inventory.movements.view",
"admin.inventory.transfers.view",
"admin.inventory.shipping-orders.view",
"admin.inventory.shipping-tracking.view",
"admin.inventory.shipping-carriers.view",
"admin.inventory.shipping-rates.view",
"admin.inventory.assets.view",
"admin.inventory.asset-maintenance.view",
"admin.inventory.asset-lifecycle.view",
"admin.inventory.asset-assignments.view",
"admin.projects.dashboard.view",
"admin.projects.view",
"admin.projects.create",
"admin.projects.tasks.view",
"admin.projects.history.view",
"admin.production.orders.view",
"admin.production.orders.create",
"admin.production.process.view",
"admin.production.history.view",
"admin.quality.inspections.view",
"admin.quality.inspections.create",
"admin.quality.reports.view",
"admin.quality.history.view",
"admin.workflows.view",
"admin.workflows.create",
"admin.workflows.automations.view",
"admin.workflows.history.view",
"admin.contracts.view",
"admin.contracts.sign",
"admin.contracts.automated.view",
"admin.contracts.history.view",
"admin.ticketing.dashboard.view",
"admin.ticketing.tickets.view",
"admin.ticketing.tickets.create",
"admin.ticketing.categories.view",
"admin.ticketing.analytics.view"
]
}

14
database/data/users.csv Normal file
View File

@ -0,0 +1,14 @@
name,email,role,password
Administrador Web,webadmin@koneko.test,Administrador Web,LAdmin123
Productos y servicios,productos@koneko.test,Productos y servicios,LAdmin123
Recursos humanos,rrhh@koneko.test,Recursos humanos,LAdmin123
Nómina,nomina@koneko.test,Nómina,LAdmin123
Activos fijos,activos@koneko.test,Activos fijos,LAdmin123
Compras y gastos,compras@koneko.test,Compras y gastos,LAdmin123
CRM,crm@koneko.test,CRM,LAdmin123
Vendedor,vendedor@koneko.test,Vendedor,LAdmin123
Gerente,gerente@koneko.test,Gerente,LAdmin123
Facturación,facturacion@koneko.test,Facturación,LAdmin123
Facturación avanzado,facturacion_avanzado@koneko.test,Facturación avanzado,LAdmin123
Finanzas,finanzas@koneko.test,Finanzas,LAdmin123
Almacenista,almacenista@koneko.test,Almacenista,LAdmin123
1 name email role password
2 Administrador Web webadmin@koneko.test Administrador Web LAdmin123
3 Productos y servicios productos@koneko.test Productos y servicios LAdmin123
4 Recursos humanos rrhh@koneko.test Recursos humanos LAdmin123
5 Nómina nomina@koneko.test Nómina LAdmin123
6 Activos fijos activos@koneko.test Activos fijos LAdmin123
7 Compras y gastos compras@koneko.test Compras y gastos LAdmin123
8 CRM crm@koneko.test CRM LAdmin123
9 Vendedor vendedor@koneko.test Vendedor LAdmin123
10 Gerente gerente@koneko.test Gerente LAdmin123
11 Facturación facturacion@koneko.test Facturación LAdmin123
12 Facturación avanzado facturacion_avanzado@koneko.test Facturación avanzado LAdmin123
13 Finanzas finanzas@koneko.test Finanzas LAdmin123
14 Almacenista almacenista@koneko.test Almacenista LAdmin123

View File

@ -0,0 +1,49 @@
<?php
namespace Koneko\VuexyAdmin\Database\factories;
use Koneko\VuexyAdmin\Models\User;
use Illuminate\Support\Facades\Hash;
use Illuminate\Support\Str;
use Illuminate\Database\Eloquent\Factories\Factory;
/**
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\Koneko\VuexyAdmin\Models\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'),
'two_factor_secret' => null,
'two_factor_recovery_codes' => null,
'remember_token' => Str::random(10),
'profile_photo_path' => null,
'status' => fake()->randomElement([User::STATUS_ENABLED, User::STATUS_DISABLED])
];
}
/**
* Indicate that the model's email address should be unverified.
*/
public function unverified(): static
{
return $this->state(fn(array $attributes) => [
'email_verified_at' => null,
]);
}
}

View File

@ -0,0 +1,44 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Support\Facades\DB;
use Illuminate\Database\Schema\Blueprint;
use Koneko\VuexyAdmin\Models\User;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
DB::statement('ALTER TABLE `users` MODIFY `id` BIGINT UNSIGNED NOT NULL;');
DB::statement('ALTER TABLE `users` DROP PRIMARY KEY;');
DB::statement('ALTER TABLE `users` MODIFY `id` MEDIUMINT UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (`id`);');
Schema::table('users', function (Blueprint $table) {
$table->string('last_name', 100)->nullable()->comment('Apellidos')->index()->after('name');
$table->string('profile_photo_path', 2048)->nullable()->after('remember_token');
$table->unsignedTinyInteger('status')->default(User::STATUS_DISABLED)->after('profile_photo_path');
$table->unsignedMediumInteger('created_by')->nullable()->index()->after('status');
// Definir la relación con created_by
$table->foreign('created_by')->references('id')->on('users')->onUpdate('restrict')->onDelete('restrict');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
DB::statement('ALTER TABLE `users` MODIFY `id` MEDIUMINT UNSIGNED NOT NULL;');
DB::statement('ALTER TABLE `users` DROP PRIMARY KEY;');
DB::statement('ALTER TABLE `users` MODIFY `id` BIGINT UNSIGNED NOT NULL AUTO_INCREMENT, ADD PRIMARY KEY (`id`);');
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(['last_name', 'profile_photo_path', 'status', 'created_by']);
});
}
};

View File

@ -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::create('user_logins', function (Blueprint $table) {
$table->integerIncrements('id');
$table->unsignedMediumInteger('user_id')->nullable()->index();
$table->ipAddress('ip_address')->nullable();
$table->string('user_agent')->nullable();
$table->timestamps();
// Relaciones
$table->foreign('user_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
// Elimina tablas solo si existen
Schema::dropIfExists('user_logins');
}
};

View File

@ -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->string('name');
$table->string('token', 64)->unique();
$table->text('abilities')->nullable();
$table->timestamp('last_used_at')->nullable();
$table->timestamp('expires_at')->nullable();
$table->timestamps();
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('personal_access_tokens');
}
};

View File

@ -0,0 +1,153 @@
<?php
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;
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';
if (empty($tableNames)) {
throw new \Exception('Error: config/permission.php not loaded. Run [php artisan config:clear] and try again.');
}
if ($teams && empty($columnNames['team_foreign_key'] ?? null)) {
throw new \Exception('Error: team_foreign_key on config/permission.php not loaded. Run [php artisan config:clear] and try again.');
}
Schema::create($tableNames['permissions'], 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('group_name')->nullable()->index();
$table->string('sub_group_name')->nullable()->index();
$table->string('action')->nullable()->index();
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
$table->timestamps();
$table->unique(['name', 'guard_name']);
$table->unique(['group_name', 'sub_group_name', 'action', 'guard_name']);
});
Schema::create($tableNames['roles'], 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('style')->nullable();
$table->string('guard_name'); // For MyISAM use string('guard_name', 25);
$table->timestamps();
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'], 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'], 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'], 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');
if (empty($tableNames)) {
throw new \Exception('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']);
}
};

View File

@ -0,0 +1,46 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
use Laravel\Fortify\Fortify;
return new class extends Migration
{
/**
* Run the migrations.
*/
public function up(): void
{
Schema::table('users', function (Blueprint $table) {
$table->text('two_factor_secret')
->after('password')
->nullable();
$table->text('two_factor_recovery_codes')
->after('two_factor_secret')
->nullable();
if (Fortify::confirmsTwoFactorAuthentication()) {
$table->timestamp('two_factor_confirmed_at')
->after('two_factor_recovery_codes')
->nullable();
}
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::table('users', function (Blueprint $table) {
$table->dropColumn(array_merge([
'two_factor_secret',
'two_factor_recovery_codes',
], Fortify::confirmsTwoFactorAuthentication() ? [
'two_factor_confirmed_at',
] : []));
});
}
};

View File

@ -0,0 +1,37 @@
<?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('settings', function (Blueprint $table) {
$table->mediumIncrements('id');
$table->string('key')->index();
$table->text('value');
$table->unsignedMediumInteger('user_id')->nullable()->index();
// Unique constraints
$table->unique(['user_id', 'key']);
// Relaciones
$table->foreign('user_id')->references('id')->on('users');
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('settings');
}
};

View File

@ -0,0 +1,48 @@
<?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('media_items', function (Blueprint $table) {
$table->mediumIncrements('id');
// Relación polimórfica
$table->unsignedMediumInteger('mediaable_id');
$table->string('mediaable_type');
$table->unsignedTinyInteger('type')->index(); // Tipo de medio: 'image', 'video', 'file', 'youtube'
$table->unsignedTinyInteger('sub_type')->index(); // Subtipo de medio: 'thumbnail', 'main', 'additional'
$table->string('url', 255)->nullable(); // URL del medio
$table->string('path')->nullable(); // Ruta del archivo si está almacenado localmente
$table->string('title')->nullable()->index(); // Título del medio
$table->mediumText('description')->nullable(); // Descripción del medio
$table->unsignedTinyInteger('order')->nullable(); // Orden de presentación
// Authoría
$table->timestamps();
// Índices
$table->index(['mediaable_type', 'mediaable_id']);
$table->index(['mediaable_type', 'mediaable_id', 'type']);
});
}
/**
* Reverse the migrations.
*/
public function down(): void
{
Schema::dropIfExists('images');
}
};

View File

@ -0,0 +1,52 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
$connection = config('audit.drivers.database.connection', config('database.default'));
$table = config('audit.drivers.database.table', 'audits');
Schema::connection($connection)->create($table, function (Blueprint $table) {
$morphPrefix = config('audit.user.morph_prefix', 'user');
$table->bigIncrements('id');
$table->string($morphPrefix . '_type')->nullable();
$table->unsignedBigInteger($morphPrefix . '_id')->nullable();
$table->string('event');
$table->morphs('auditable');
$table->text('old_values')->nullable();
$table->text('new_values')->nullable();
$table->text('url')->nullable();
$table->ipAddress('ip_address')->nullable();
$table->string('user_agent', 1023)->nullable();
$table->string('tags')->nullable();
$table->timestamps();
$table->index([$morphPrefix . '_id', $morphPrefix . '_type']);
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$connection = config('audit.drivers.database.connection', config('database.default'));
$table = config('audit.drivers.database.table', 'audits');
Schema::connection($connection)->drop($table);
}
};

View File

@ -0,0 +1,14 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Koneko\VuexyAdmin\Services\RBACService;
class PermissionSeeder extends Seeder
{
public function run()
{
RBACService::loadRolesAndPermissions();
}
}

View File

@ -0,0 +1,109 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Illuminate\Support\Facades\Crypt;
use Koneko\VuexyAdmin\Models\Setting;
class SettingSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$settings_array = [
/*
'app_title' => 'Quimiplastic S.A de C.V.',
'app_faviconIcon' => '../assets/img/logo/koneko-02.png',
'app_name' => 'Quimiplastic',
'app_imageLogo' => '../assets/img/logo/koneko-02.png',
'app_myLayout' => 'vertical',
'app_myTheme' => 'theme-default',
'app_myStyle' => 'light',
'app_navbarType' => 'sticky',
'app_menuFixed' => true,
'app_menuCollapsed' => false,
'app_headerType' => 'static',
'app_showDropdownOnHover' => false,
'app_authViewMode' => 'cover',
'app_maxQuickLinks' => 5,
'smtp.host' => 'webmail.koneko.mx',
'smtp.port' => 465,
'smtp.encryption' => 'tls',
'smtp.username' => 'no-responder@koneko.mx',
'smtp.password' => null,
'smtp.from_email' => 'no-responder@koneko.mx',
'smtp.from_name' => 'Koneko Soluciones en Tecnología',
'smtp.reply_to_method' => 'smtp',
'smtp.reply_to_email' => null,
'smtp.reply_to_name' => null,
'website.title',
'website.favicon',
'website.description',
'website.image_logo',
'website.image_logoDark',
'admin.title',
'admin.favicon',
'admin.description',
'admin.image_logo',
'admin.image_logoDark',
'favicon.icon' => null,
'contact.phone_number' => '(222) 462 0903',
'contact.phone_number_ext' => 'Ext. 5',
'contact.email' => 'virtualcompras@live.com.mx',
'contact.form.email' => 'contacto@conciergetravellife.com',
'contact.form.email_cc' => 'arturo@koneko.mx',
'contact.form.subject' => 'Has recibido un mensaje del formulario de covirsast.com',
'contact.direccion' => '51 PTE 505 loc. 14, Puebla, Pue.',
'contact.horario' => '9am - 7 pm',
'contact.location.lat' => '19.024439',
'contact.location.lng' => '-98.215777',
'social.whatsapp' => '',
'social.whatsapp.message' => '👋 Hola! Estoy buscando más información sobre Covirsa Soluciones en Tecnología. ¿Podrías proporcionarme los detalles que necesito? ¡Te lo agradecería mucho! 💻✨',
'social.facebook' => 'https://www.facebook.com/covirsast/?locale=es_LA',
'social.Whatsapp' => '2228 200 201',
'social.Whatsapp.message' => '¡Hola! 🌟 Estoy interesado en obtener más información acerca de Concierge Travel. ¿Podrías ayudarme con los detalles? ¡Gracias de antemano! ✈️🏝',
'social.Facebook' => 'test',
'social.Instagram' => 'test',
'social.Linkedin' => 'test',
'social.Tiktok' => 'test',
'social.X_twitter' => 'test',
'social.Google' => 'test',
'social.Pinterest' => 'test',
'social.Youtube' => 'test',
'social.Vimeo' => 'test',
'chat.provider' => '',
'chat.whatsapp.number' => '',
'chat.whatsapp.message' => '👋 Hola! Estoy buscando más información sobre Covirsa Soluciones en Tecnología. ¿Podrías proporcionarme los detalles que necesito? ¡Te lo agradecería mucho! 💻✨',
'webTpl.container' => 'custom-container',
*/
];
foreach ($settings_array as $key => $value) {
Setting::create([
'key' => $key,
'value' => $value,
]);
};
}
}

View File

@ -0,0 +1,97 @@
<?php
namespace Database\Seeders;
use Koneko\VuexyAdmin\Models\User;
use Koneko\VuexyAdmin\Services\AvatarImageService;
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;
use Illuminate\Database\Seeder;
class UserSeeder extends Seeder
{
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
// Define el disco y la carpeta
$disk = 'public';
$directory = 'profile-photos';
// Verifica si la carpeta existe
if (Storage::disk($disk)->exists($directory))
Storage::disk($disk)->deleteDirectory($directory);
//
$avatarImageService = new AvatarImageService();
// Super admin
$user = User::create([
'name' => 'Koneko Admin',
'email' => 'sadmin@koneko.mx',
'email_verified_at' => now(),
'password' => bcrypt('LAdmin123'),
'status' => User::STATUS_ENABLED,
])->assignRole('SuperAdmin');
// Actualizamos la foto
$avatarImageService->updateProfilePhoto($user, new UploadedFile(
'public/vendor/vuexy-admin/img/logo/koneko-02.png',
'koneko-02.png'
));
// admin
$user = User::create([
'name' => 'Admin',
'email' => 'admin@koneko.mx',
'email_verified_at' => now(),
'password' => bcrypt('LAdmin123'),
'status' => User::STATUS_ENABLED,
])->assignRole('Admin');
$avatarImageService->updateProfilePhoto($user, new UploadedFile(
'public/vendor/vuexy-admin/img/logo/koneko-03.png',
'koneko-03.png'
));
// Auditor
$user = User::create([
'name' => 'Auditor',
'email' => 'auditor@koneko.mx',
'email_verified_at' => now(),
'password' => bcrypt('LAdmin123'),
'status' => User::STATUS_ENABLED,
])->assignRole('Auditor');
$avatarImageService->updateProfilePhoto($user, new UploadedFile(
'public/vendor/vuexy-admin/img/logo/koneko-03.png',
'koneko-03.png'
));
// Usuarios CSV
$csvFile = fopen(base_path("database/data/users.csv"), "r");
$firstline = true;
while (($data = fgetcsv($csvFile, 2000, ",")) !== FALSE) {
if (!$firstline) {
User::create([
'name' => $data['0'],
'email' => $data['1'],
'email_verified_at' => now(),
'password' => bcrypt($data['3']),
'status' => User::STATUS_ENABLED,
])->assignRole($data['2']);
}
$firstline = false;
}
fclose($csvFile);
}
}