Estructura de base de datos, migraciones, factories y seeders
This commit is contained in:
@@ -6,6 +6,7 @@ use App\Models\Cliente;
|
||||
use App\Models\CredencialCliente;
|
||||
use App\Models\Persona;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Cliente>
|
||||
@@ -30,8 +31,19 @@ class ClienteFactory extends Factory
|
||||
'dni' => (string) $this->faker->unique()->numberBetween(20000000, 45000000),
|
||||
'correo' => $this->faker->unique()->safeEmail(),
|
||||
'persona_id' => Persona::factory(),
|
||||
'baja_id' => null,
|
||||
'baja_id' => 1,
|
||||
'credencialcliente_id' => CredencialCliente::factory(),
|
||||
];
|
||||
}
|
||||
|
||||
public function configure(): static
|
||||
{
|
||||
return $this->afterCreating(function (Cliente $cliente) {
|
||||
CredencialCliente::where('id', $cliente->credencialcliente_id)
|
||||
->update([
|
||||
'correo' => $cliente->correo,
|
||||
'contra' => Hash::make($cliente->dni),
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ class CredencialProfesionalFactory extends Factory
|
||||
return [
|
||||
'usuario' => $this->faker->unique()->userName(),
|
||||
'contra' => Hash::make('password'),
|
||||
'rol' => $this->faker->randomElement(['Administrador', 'Profesional']),
|
||||
'rol' => 'Profesional',
|
||||
'token' => null,
|
||||
'fecha_hora' => null,
|
||||
];
|
||||
|
||||
@@ -29,13 +29,23 @@ class PersonaFactory extends Factory
|
||||
$cuilPrefix = $this->faker->randomElement(['20', '27']);
|
||||
$cuilSuffix = $this->faker->numberBetween(0, 9);
|
||||
|
||||
$fotoDefault = Foto::firstOrCreate(
|
||||
['ruta' => 'images/avatar_default.png'],
|
||||
[
|
||||
'extension' => 'png',
|
||||
'tamanio_bytes' => 136788,
|
||||
'nombre' => 'avatar_default',
|
||||
'mime_type' => 'image/png',
|
||||
]
|
||||
);
|
||||
|
||||
return [
|
||||
'dni' => (string) $dni,
|
||||
'nombre' => $this->faker->firstName(),
|
||||
'apellido' => $this->faker->lastName(),
|
||||
'cuil' => "{$cuilPrefix}{$dni}{$cuilSuffix}",
|
||||
'fechanac' => $this->faker->dateTimeBetween('-60 years', '-18 years')->format('Y-m-d'),
|
||||
'foto_id' => Foto::factory(),
|
||||
'foto_id' => $fotoDefault->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\CredencialProfesional;
|
||||
use App\Models\EstadoProfesional;
|
||||
use App\Models\Persona;
|
||||
use App\Models\Profesional;
|
||||
use App\Models\Profesion;
|
||||
@@ -35,8 +34,15 @@ class ProfesionalFactory extends Factory
|
||||
'persona_id' => Persona::factory(),
|
||||
'profesion_id' => Profesion::factory(),
|
||||
'credencialprofesional_id' => CredencialProfesional::factory(),
|
||||
'estadoprofesional_id' => EstadoProfesional::factory(),
|
||||
'baja_id' => null,
|
||||
'baja_id' => 1,
|
||||
];
|
||||
}
|
||||
|
||||
public function configure(): static
|
||||
{
|
||||
return $this->afterCreating(function (Profesional $profesional) {
|
||||
CredencialProfesional::where('id', $profesional->credencialprofesional_id)
|
||||
->update(['usuario' => $profesional->dni . '-' . $profesional->profesion_id]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,11 @@
|
||||
|
||||
namespace Database\Factories;
|
||||
|
||||
use App\Models\Foto;
|
||||
use App\Models\Servicio;
|
||||
use App\Models\Profesion;
|
||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
/**
|
||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<\App\Models\Servicio>
|
||||
@@ -24,9 +27,24 @@ class ServicioFactory extends Factory
|
||||
*/
|
||||
public function definition(): array
|
||||
{
|
||||
$fotoDefault = Foto::firstOrCreate(
|
||||
['ruta' => 'images/Servicio.jpg'],
|
||||
[
|
||||
'extension' => 'jpg',
|
||||
'tamanio_bytes' => 0,
|
||||
'nombre' => 'Servicio',
|
||||
'mime_type' => 'image/jpeg',
|
||||
]
|
||||
);
|
||||
|
||||
return [
|
||||
'nombre' => $this->faker->words(3, true),
|
||||
'descripcion' => $this->faker->sentence(12),
|
||||
'titulo' => $this->faker->unique()->bs(),
|
||||
'estado' => 'activo',
|
||||
'descripcion' => $this->faker->sentence(12),
|
||||
'visibleenweb' => 'si',
|
||||
'contenidoweb_id' => DB::table('contenidoswebs')->value('id'),
|
||||
'profesion_id' => Profesion::factory(),
|
||||
'foto_id' => $fotoDefault->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ return new class extends Migration
|
||||
Schema::create('bajas', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
$table->text('motivo')->nullable();
|
||||
$table->text('descripcion');
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -25,15 +25,12 @@ return new class extends Migration
|
||||
$table->foreignId('credencialprofesional_id')
|
||||
->constrained('credencialesprofesionales');
|
||||
|
||||
$table->foreignId('estadoprofesional_id')
|
||||
->constrained('estadosprofesionales');
|
||||
|
||||
$table->foreignId('persona_id')
|
||||
->constrained('personas');
|
||||
|
||||
$table->foreignId('baja_id')
|
||||
->nullable()
|
||||
->constrained('bajas');
|
||||
->default(1)
|
||||
->constrained('bajas');
|
||||
|
||||
$table->unique(['profesion_id', 'matricula']);
|
||||
});
|
||||
|
||||
@@ -26,8 +26,9 @@ return new class extends Migration
|
||||
->constrained('personas')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('baja_id')->nullable()
|
||||
->constrained('bajas')
|
||||
$table->foreignId('baja_id')
|
||||
->default(1)
|
||||
->constrained('bajas')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unique(['dni','correo']);
|
||||
|
||||
@@ -14,7 +14,6 @@ return new class extends Migration
|
||||
Schema::create('diasdeatenciones', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
$table->string('descripcion');
|
||||
$table->foreignId('agenda_id')
|
||||
->constrained('agendas')
|
||||
->onDelete('cascade');
|
||||
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('bajas')->updateOrInsert(
|
||||
['id' => 1],
|
||||
[
|
||||
'descripcion' => 'Activo',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
|
||||
DB::table('bajas')->updateOrInsert(
|
||||
['id' => 2],
|
||||
[
|
||||
'descripcion' => 'Baja',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
|
||||
DB::statement('ALTER TABLE profesionales MODIFY baja_id BIGINT UNSIGNED NOT NULL DEFAULT 1');
|
||||
DB::statement('ALTER TABLE clientes MODIFY baja_id BIGINT UNSIGNED NOT NULL DEFAULT 1');
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
DB::statement('ALTER TABLE profesionales MODIFY baja_id BIGINT UNSIGNED NOT NULL');
|
||||
DB::statement('ALTER TABLE clientes MODIFY baja_id BIGINT UNSIGNED NOT NULL');
|
||||
}
|
||||
};
|
||||
@@ -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
|
||||
{
|
||||
if (!Schema::hasColumn('servicios', 'visibleenweb')) {
|
||||
Schema::table('servicios', function (Blueprint $table) {
|
||||
$table->text('visibleenweb')->default('si');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (Schema::hasColumn('servicios', 'visibleenweb')) {
|
||||
Schema::table('servicios', function (Blueprint $table) {
|
||||
$table->dropColumn('visibleenweb');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -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('profesionales_profesiones', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
|
||||
$table->foreignId('profesional_id')
|
||||
->constrained('profesionales')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->foreignId('profesion_id')
|
||||
->constrained('profesiones')
|
||||
->onDelete('cascade');
|
||||
|
||||
$table->unique(['profesional_id', 'profesion_id'], 'profesionales_profesiones_unique');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('profesionales_profesiones');
|
||||
}
|
||||
};
|
||||
@@ -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('faq_asistentes', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->string('intencion', 100)->nullable();
|
||||
$table->json('palabras_clave')->nullable();
|
||||
$table->text('respuesta');
|
||||
$table->unsignedSmallInteger('orden')->default(0);
|
||||
$table->boolean('activo')->default(true);
|
||||
$table->timestamps();
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('faq_asistentes');
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,33 @@
|
||||
<?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
|
||||
{
|
||||
Schema::table('contenidoswebs', function (Blueprint $table) {
|
||||
$table->string('version')->default('1.0.0')->after('quienessomos');
|
||||
});
|
||||
|
||||
DB::table('contenidoswebs')->update([
|
||||
'version' => '1.0.0',
|
||||
]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('contenidoswebs', function (Blueprint $table) {
|
||||
$table->dropColumn('version');
|
||||
});
|
||||
}
|
||||
};
|
||||
+32
@@ -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
|
||||
{
|
||||
if (Schema::hasColumn('diasdeatenciones', 'descripcion')) {
|
||||
Schema::table('diasdeatenciones', function (Blueprint $table) {
|
||||
$table->dropColumn('descripcion');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (!Schema::hasColumn('diasdeatenciones', 'descripcion')) {
|
||||
Schema::table('diasdeatenciones', function (Blueprint $table) {
|
||||
$table->string('descripcion')->nullable();
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -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
|
||||
{
|
||||
if (!Schema::hasColumn('turnos', 'celular')) {
|
||||
Schema::table('turnos', function (Blueprint $table) {
|
||||
$table->string('celular')->nullable()->after('correo');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (Schema::hasColumn('turnos', 'celular')) {
|
||||
Schema::table('turnos', function (Blueprint $table) {
|
||||
$table->dropColumn('celular');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,44 @@
|
||||
<?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
|
||||
{
|
||||
if (Schema::hasTable('credencialesclientes') && !Schema::hasColumn('credencialesclientes', 'session_id')) {
|
||||
Schema::table('credencialesclientes', function (Blueprint $table) {
|
||||
$table->string('session_id')->nullable()->after('token');
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasTable('credencialesprofesionales') && !Schema::hasColumn('credencialesprofesionales', 'session_id')) {
|
||||
Schema::table('credencialesprofesionales', function (Blueprint $table) {
|
||||
$table->string('session_id')->nullable()->after('token');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
if (Schema::hasTable('credencialesclientes') && Schema::hasColumn('credencialesclientes', 'session_id')) {
|
||||
Schema::table('credencialesclientes', function (Blueprint $table) {
|
||||
$table->dropColumn('session_id');
|
||||
});
|
||||
}
|
||||
|
||||
if (Schema::hasTable('credencialesprofesionales') && Schema::hasColumn('credencialesprofesionales', 'session_id')) {
|
||||
Schema::table('credencialesprofesionales', function (Blueprint $table) {
|
||||
$table->dropColumn('session_id');
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -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::create('notificaciones', function (Blueprint $table) {
|
||||
$table->bigIncrements('notificacion_id');
|
||||
$table->string('tipo');
|
||||
$table->text('mensaje_inicio');
|
||||
$table->text('mensaje_final');
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('notificaciones');
|
||||
}
|
||||
};
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?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('credencialesclientes', function (Blueprint $table) {
|
||||
$table->string('reset_token')->nullable()->after('token');
|
||||
$table->datetime('reset_expira_en')->nullable()->after('reset_token');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('credencialesclientes', function (Blueprint $table) {
|
||||
$table->dropColumn(['reset_token', 'reset_expira_en']);
|
||||
});
|
||||
}
|
||||
};
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?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('credencialesprofesionales', function (Blueprint $table) {
|
||||
$table->string('reset_token')->nullable()->after('token');
|
||||
$table->datetime('reset_expira_en')->nullable()->after('reset_token');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('credencialesprofesionales', function (Blueprint $table) {
|
||||
$table->dropColumn(['reset_token', 'reset_expira_en']);
|
||||
});
|
||||
}
|
||||
};
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<?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('administradores', function (Blueprint $table) {
|
||||
$table->string('pregunta_secreta_hash')->nullable()->after('correo');
|
||||
$table->string('respuesta_secreta_hash')->nullable()->after('pregunta_secreta_hash');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('administradores', function (Blueprint $table) {
|
||||
$table->dropColumn(['pregunta_secreta_hash', 'respuesta_secreta_hash']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,22 @@
|
||||
<?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('formularios', function (Blueprint $table) {
|
||||
$table->string('ip_origen', 45)->nullable()->after('celular');
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('formularios', function (Blueprint $table) {
|
||||
$table->dropColumn('ip_origen');
|
||||
});
|
||||
}
|
||||
};
|
||||
+5
-5
@@ -11,10 +11,8 @@ return new class extends Migration
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
Schema::create('estadosprofesionales', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->timestamps();
|
||||
$table->string('descripcion')->default('Activo');
|
||||
Schema::table('servicios', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('foto_id')->nullable()->change();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -23,6 +21,8 @@ return new class extends Migration
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('estadosprofesionales');
|
||||
Schema::table('servicios', function (Blueprint $table) {
|
||||
$table->unsignedBigInteger('foto_id')->nullable(false)->change();
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,42 @@
|
||||
<?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
|
||||
{
|
||||
Schema::table('logseguridades', function (Blueprint $table) {
|
||||
$table->string('accion_descripcion')->nullable()->after('accion_id');
|
||||
$table->string('responsable_nombre')->nullable()->after('persona_id');
|
||||
});
|
||||
|
||||
DB::statement(<<<'SQL'
|
||||
UPDATE logseguridades AS logs
|
||||
LEFT JOIN accioneslogs AS acciones ON acciones.id = logs.accion_id
|
||||
LEFT JOIN personas AS personas ON personas.id = logs.persona_id
|
||||
SET
|
||||
logs.accion_descripcion = COALESCE(logs.accion_descripcion, acciones.descripcion),
|
||||
logs.responsable_nombre = COALESCE(
|
||||
logs.responsable_nombre,
|
||||
NULLIF(TRIM(CONCAT(COALESCE(personas.nombre, ''), ' ', COALESCE(personas.apellido, ''))), '')
|
||||
)
|
||||
SQL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
Schema::table('logseguridades', function (Blueprint $table) {
|
||||
$table->dropColumn(['accion_descripcion', 'responsable_nombre']);
|
||||
});
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Database\Migrations\Migration;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
return new class extends Migration
|
||||
{
|
||||
/**
|
||||
* Run the migrations.
|
||||
*/
|
||||
public function up(): void
|
||||
{
|
||||
DB::table('accioneslogs')->updateOrInsert(
|
||||
['descripcion' => 'Edito los datos del administrador'],
|
||||
[
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reverse the migrations.
|
||||
*/
|
||||
public function down(): void
|
||||
{
|
||||
DB::table('accioneslogs')
|
||||
->where('descripcion', 'Edito los datos del administrador')
|
||||
->delete();
|
||||
}
|
||||
};
|
||||
@@ -0,0 +1,23 @@
|
||||
<?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('asistente_sin_respuesta', function (Blueprint $table) {
|
||||
$table->id();
|
||||
$table->text('consulta');
|
||||
$table->boolean('revisado')->default(false);
|
||||
$table->timestamp('created_at')->useCurrent();
|
||||
});
|
||||
}
|
||||
|
||||
public function down(): void
|
||||
{
|
||||
Schema::dropIfExists('asistente_sin_respuesta');
|
||||
}
|
||||
};
|
||||
@@ -13,50 +13,65 @@ class AccionLogSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
|
||||
//IMPORTANTE: El orden de las acciones no se debe modificar, ya que se asocian a los logs por su ID. Agregar nuevas acciones al final del array.
|
||||
|
||||
|
||||
$acciones = [
|
||||
['descripcion' => 'Creación nuevo profesional'],
|
||||
['descripcion' => 'Baja profesional'],
|
||||
['descripcion' => 'Alta profesional'],
|
||||
['descripcion' => 'Edición datos profesional'],
|
||||
['descripcion' => 'Creación nuevo profesional'], //
|
||||
['descripcion' => 'Baja profesional'], //
|
||||
['descripcion' => 'Alta profesional'], //
|
||||
['descripcion' => 'Edición datos profesional'], //
|
||||
|
||||
['descripcion' => 'Creación nuevo servicio'],
|
||||
['descripcion' => 'Baja servicio'],
|
||||
['descripcion' => 'Alta servicio'],
|
||||
['descripcion' => 'Edición datos servicio'],
|
||||
['descripcion' => 'Creación nuevo servicio'], //
|
||||
['descripcion' => 'Baja servicio'], //
|
||||
['descripcion' => 'Alta servicio'], //
|
||||
['descripcion' => 'Edición datos servicio'], //
|
||||
|
||||
['descripcion' => 'Creación nueva profesion'],
|
||||
['descripcion' => 'Baja profesion'],
|
||||
['descripcion' => 'Alta profesion'],
|
||||
['descripcion' => 'Edición datos profesion'],
|
||||
['descripcion' => 'Creación nueva profesion'], //
|
||||
['descripcion' => 'Baja profesion'], //
|
||||
['descripcion' => 'Alta profesion'], //
|
||||
['descripcion' => 'Edición datos profesion'], //
|
||||
|
||||
['descripcion'=> 'Creación nuevo cliente'],
|
||||
['descripcion'=> 'Edición datos cliente'],
|
||||
['descripcion'=> 'Agregó documentación cliente'],
|
||||
['descripcion'=> 'Dar de baja cliente'],
|
||||
['descripcion'=> 'Creación nuevo cliente'], //
|
||||
['descripcion'=> 'Edición datos cliente'], //
|
||||
['descripcion'=> 'Agregó documentación cliente'], //
|
||||
['descripcion'=> 'Dar de baja cliente'], //
|
||||
|
||||
['descripcion'=> 'Asignó un turno'],
|
||||
['descripcion'=> 'Canceló un turno'],
|
||||
['descripcion'=> 'Reprogramó un turno'],
|
||||
['descripcion'=> 'Asignó un turno'], //
|
||||
['descripcion'=> 'Canceló un turno'], //
|
||||
['descripcion'=> 'Reprogramó un turno'], //
|
||||
|
||||
['descripcion'=> 'Aceptó un caso'],
|
||||
['descripcion'=> 'Rechazó un caso'],
|
||||
['descripcion'=> 'Aceptó un caso'], //
|
||||
['descripcion'=> 'Rechazó un caso'], //
|
||||
['descripcion'=> 'Devolvió un caso'],
|
||||
|
||||
['descripcion'=> 'Inició sesión'],
|
||||
['descripcion'=> 'Cerró sesión'],
|
||||
['descripcion'=> 'Inició sesión'], //
|
||||
['descripcion'=> 'Cerró sesión'], //
|
||||
|
||||
['descripcion'=> 'Solicitud cambio de contraseña'],
|
||||
['descripcion'=> 'Cambio de contraseña exitoso'],
|
||||
['descripcion'=> 'Solicitud cambio de contraseña'], //
|
||||
['descripcion'=> 'Cambio de contraseña exitoso'], //
|
||||
['descripcion'=> 'Cambio de contraseña frustrado'],
|
||||
|
||||
//agregados despues
|
||||
|
||||
['descripcion'=> 'Dar de alta cliente'], //
|
||||
['descripcion'=> 'Eliminó documentación cliente'], //
|
||||
['descripcion'=> 'dio de baja relacion con cliente'], //
|
||||
['descripcion'=> 'dio de alta relacion con cliente'], //
|
||||
['descripcion'=> 'Cambio de DNI Cliente'], //
|
||||
['descripcion'=> 'Cambio de DNI Profesional'], //
|
||||
['descripcion'=> 'Edito los datos del administrador'], //
|
||||
];
|
||||
|
||||
foreach($acciones as $accion)
|
||||
{
|
||||
DB::table('accioneslogs')->insert([
|
||||
'descripcion' => $accion['descripcion'],
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
foreach ($acciones as $accion) {
|
||||
DB::table('accioneslogs')->updateOrInsert(
|
||||
['descripcion' => $accion['descripcion']],
|
||||
[
|
||||
'updated_at' => now(),
|
||||
'created_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,9 +2,14 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use App\Models\Administrador;
|
||||
use App\Models\CredencialProfesional;
|
||||
use App\Models\Foto;
|
||||
use App\Models\Persona;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Hash;
|
||||
|
||||
class AdministradorSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
@@ -12,13 +17,84 @@ class AdministradorSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$administrador = [
|
||||
'persona_id' => 1,
|
||||
'dni' => '40563707',
|
||||
'correo' => 'CamyBelini@gmail.com',
|
||||
'credencialprofesional_id' => 1,
|
||||
];
|
||||
$usuario = env('ADMIN_USUARIO', 'admin');
|
||||
$passwordPlano = env('ADMIN_PASSWORD', 'admin1234');
|
||||
$correo = env('ADMIN_CORREO', 'admin@abogadaslitoral.com');
|
||||
$dni = env('ADMIN_DNI', '30000000');
|
||||
$nombre = env('ADMIN_NOMBRE', 'Usuario');
|
||||
$apellido = env('ADMIN_APELLIDO', 'Administrador');
|
||||
$cuil = env('ADMIN_CUIL', '20-30000000-0');
|
||||
$fechaNac = env('ADMIN_FECHANAC', '2026-01-01');
|
||||
$preguntaSecreta = mb_strtolower(trim((string) env('ADMIN_PREGUNTA_SECRETA', 'Cual es el nombre de tu primera mascota')));
|
||||
$respuestaSecreta = mb_strtolower(trim((string) env('ADMIN_RESPUESTA_SECRETA', 'admin')));
|
||||
|
||||
DB::table('administradores')->insert($administrador);
|
||||
DB::transaction(function () use (
|
||||
$apellido,
|
||||
$correo,
|
||||
$cuil,
|
||||
$dni,
|
||||
$fechaNac,
|
||||
$nombre,
|
||||
$passwordPlano,
|
||||
$preguntaSecreta,
|
||||
$respuestaSecreta,
|
||||
$usuario
|
||||
): void {
|
||||
$foto = Foto::query()->firstOrCreate(
|
||||
['ruta' => 'images/avatar_default.png'],
|
||||
[
|
||||
'extension' => 'png',
|
||||
'nombre' => 'avatar_default',
|
||||
'mime_type' => 'image/png',
|
||||
'tamanio_bytes' => 136788,
|
||||
]
|
||||
);
|
||||
|
||||
$persona = Persona::query()->updateOrCreate(
|
||||
['dni' => $dni],
|
||||
[
|
||||
'nombre' => $nombre,
|
||||
'apellido' => $apellido,
|
||||
'cuil' => $cuil,
|
||||
'fechanac' => $fechaNac,
|
||||
'foto_id' => $foto->id,
|
||||
]
|
||||
);
|
||||
|
||||
$credencial = CredencialProfesional::query()->updateOrCreate(
|
||||
['usuario' => $usuario],
|
||||
[
|
||||
'contra' => Hash::make($passwordPlano),
|
||||
'rol' => 'ADMIN',
|
||||
]
|
||||
);
|
||||
|
||||
$administrador = Administrador::query()
|
||||
->where('persona_id', $persona->id)
|
||||
->orWhere('dni', $dni)
|
||||
->first();
|
||||
|
||||
if ($administrador) {
|
||||
$administrador->update([
|
||||
'persona_id' => $persona->id,
|
||||
'dni' => $dni,
|
||||
'correo' => $correo,
|
||||
'pregunta_secreta_hash' => $preguntaSecreta,
|
||||
'respuesta_secreta_hash' => Hash::make($respuestaSecreta),
|
||||
'credencialprofesional_id' => $credencial->id,
|
||||
]);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Administrador::query()->create([
|
||||
'persona_id' => $persona->id,
|
||||
'dni' => $dni,
|
||||
'correo' => $correo,
|
||||
'pregunta_secreta_hash' => $preguntaSecreta,
|
||||
'respuesta_secreta_hash' => Hash::make($respuestaSecreta),
|
||||
'credencialprofesional_id' => $credencial->id,
|
||||
]);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -12,17 +12,22 @@ class BajaSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$bajas = [
|
||||
['motivo' => 'Cliente no responde'],
|
||||
['motivo' => 'Servicio cancelado'],
|
||||
];
|
||||
|
||||
foreach ($bajas as $baja) {
|
||||
DB::table('bajas')->insert([
|
||||
'motivo' => $baja['motivo'],
|
||||
DB::table('bajas')->updateOrInsert(
|
||||
['id' => 1],
|
||||
[
|
||||
'descripcion' => 'Activo',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
]
|
||||
);
|
||||
|
||||
DB::table('bajas')->updateOrInsert(
|
||||
['id' => 2],
|
||||
[
|
||||
'descripcion' => 'Baja',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use App\Models\Cliente;
|
||||
use App\Models\Profesional;
|
||||
use App\Models\Profesion;
|
||||
use Illuminate\Database\Seeder;
|
||||
use App\Models\Servicio;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class BulkDataSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Seed large batches of synthetic data.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$clientes = max(0, (int) config('bulk_seed.clientes', (int) env('SEED_CLIENTES', 1000)));
|
||||
$profesionales = max(0, (int) config('bulk_seed.profesionales', (int) env('SEED_PROFESIONALES', 100)));
|
||||
$servicios = max(0, (int) config('bulk_seed.servicios', (int) env('SEED_SERVICIOS', 30)));
|
||||
$profesiones = max(0, (int) config('bulk_seed.profesiones', (int) env('SEED_PROFESIONES', 4)));
|
||||
|
||||
// Profesiones nuevas
|
||||
if ($profesiones > 0) {
|
||||
Profesion::factory()->count($profesiones)->create();
|
||||
}
|
||||
|
||||
$profesionIds = Profesion::query()->pluck('id')->all();
|
||||
|
||||
// Servicios
|
||||
if ($servicios > 0 && count($profesionIds) > 0) {
|
||||
$contenidoWebId = DB::table('contenidoswebs')->value('id');
|
||||
|
||||
Servicio::factory()
|
||||
->count($servicios)
|
||||
->state(fn () => [
|
||||
'profesion_id' => $profesionIds[array_rand($profesionIds)],
|
||||
'contenidoweb_id' => $contenidoWebId,
|
||||
])
|
||||
->create();
|
||||
}
|
||||
|
||||
// Profesionales
|
||||
$profesionalesCreados = collect();
|
||||
if ($profesionales > 0 && count($profesionIds) > 0) {
|
||||
$profesionalesCreados = Profesional::factory()
|
||||
->count($profesionales)
|
||||
->state(fn () => [
|
||||
'profesion_id' => $profesionIds[array_rand($profesionIds)],
|
||||
])
|
||||
->create();
|
||||
}
|
||||
|
||||
// Clientes
|
||||
$clientesCreados = collect();
|
||||
if ($clientes > 0) {
|
||||
$clientesCreados = Cliente::factory()->count($clientes)->create();
|
||||
}
|
||||
|
||||
// Relacion cliente-profesional: cada cliente queda asociado a 1..3 profesionales
|
||||
if ($clientesCreados->isNotEmpty() && $profesionalesCreados->isNotEmpty()) {
|
||||
$idsProfesionales = $profesionalesCreados->pluck('id')->values()->all();
|
||||
$maxAsignables = min(3, count($idsProfesionales));
|
||||
|
||||
foreach ($clientesCreados as $cliente) {
|
||||
$cantidadAsignaciones = random_int(1, $maxAsignables);
|
||||
$idsSeleccionados = collect($idsProfesionales)
|
||||
->shuffle()
|
||||
->take($cantidadAsignaciones)
|
||||
->values()
|
||||
->all();
|
||||
|
||||
$payload = [];
|
||||
foreach ($idsSeleccionados as $profesionalId) {
|
||||
$payload[$profesionalId] = ['estadorelacion' => 'Activo'];
|
||||
}
|
||||
|
||||
$cliente->profesionales()->syncWithoutDetaching($payload);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,21 +2,23 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ContenidoWebSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$contenido = [
|
||||
'quienessomos' => 'Somos un grupo de abogadas recibidas de la Universidad Nacional del Litoral que decidimos trabajar en conjunto para resolver cualquier consulta que caiga en nuestras manos',
|
||||
];
|
||||
|
||||
DB::table('contenidoswebs')->insert('$contenido');
|
||||
DB::table('contenidoswebs')->updateOrInsert(
|
||||
['id' => 1],
|
||||
[
|
||||
'quienessomos' => 'Somos un grupo de abogadas recibidas de la Universidad Nacional del Litoral comprometidas con cada caso que llega a nuestro estudio jurídico. Desde Abogadas del Litoral, nuestra prioridad es siempre la satisfacción de nuestros clientes. No dudes en enviar un formulario con tu consulta y nosotros te asignaremos un turno para que puedas ser atendido o atendida.',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
class CredencialClienteSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$credencial = [
|
||||
'contra' => bcrypt('contraseña'),
|
||||
'correo' => 'ficticio@gmail.com',
|
||||
];
|
||||
|
||||
DB::table('credencialesclientes')->insert($credencial);
|
||||
}
|
||||
}
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
class CredencialProfesionalSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$credenciales = [[
|
||||
'usuario' => 'Administrador-Camila',
|
||||
'contra' => bcrypt('AbogadasDelLitoral-2026'),
|
||||
'rol' => 'Administrador',
|
||||
],
|
||||
[
|
||||
'usuario' => '43293244-2', //'DNI de la persona'+'-'+'codigo de profesion'
|
||||
'contra' => bcrypt('contraseñaluciano'),
|
||||
'rol' => 'Profesional',
|
||||
],
|
||||
[
|
||||
'usuario' => '40563707-1', //'DNI de la persona'+'-'+'codigo de profesion'
|
||||
'contra' => bcrypt('contraseñacamila'),
|
||||
'rol' => 'Profesional',
|
||||
]];
|
||||
foreach($credenciales as $credencial){
|
||||
DB::table('credencialesprofesionales')->insert([
|
||||
'usuario' => $credencial['usuario'],
|
||||
'contra' => $credencial['contra'],
|
||||
'rol' => $credencial['rol'],
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -23,19 +23,28 @@ class DatabaseSeeder extends Seeder
|
||||
]);
|
||||
|
||||
$this->call([
|
||||
ContenidoWebSeeder::class,
|
||||
ProfesionSeeder::class,
|
||||
EstadoTurnoSeeder::class,
|
||||
ModalidadSeeder::class,
|
||||
HorarioPreferenciaSeeder::class,
|
||||
DiaPreferenciaSeeder::class,
|
||||
AccionLogSeeder::class,
|
||||
FaqAsistenteSeeder::class,
|
||||
FotoSeeder::class,
|
||||
PersonaSeeder::class,
|
||||
EstadoProfesionalSeeder::class,
|
||||
CredencialProfesionalSeeder::class,
|
||||
ProfesionalSeeder::class,
|
||||
AdministradorSeeder::class,
|
||||
CredencialClienteSeeder::class,
|
||||
ServicioSeeder::class,
|
||||
BajaSeeder::class,
|
||||
DiasSeeder::class,
|
||||
]);
|
||||
|
||||
$bulkEnabled = (bool) config(
|
||||
'bulk_seed.enabled',
|
||||
filter_var(env('SEED_BULK_DATA', false), FILTER_VALIDATE_BOOLEAN)
|
||||
);
|
||||
|
||||
if ($bulkEnabled) {
|
||||
$this->call(BulkDataSeeder::class);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DiaPreferenciaSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$dias = [
|
||||
['descripcion' => 'Lunes'],
|
||||
['descripcion' => 'Martes'],
|
||||
['descripcion' => 'Miercoles'],
|
||||
['descripcion' => 'Jueves'],
|
||||
['descripcion' => 'Viernes'],
|
||||
['descripcion' => 'Sabado'],
|
||||
['descripcion' => 'Domingo'],
|
||||
['descripcion' => 'Indistinto'],
|
||||
];
|
||||
|
||||
foreach ($dias as $dia) {
|
||||
DB::table('diaspreferencias')->insert([
|
||||
'descripcion' => $dia['descripcion'],
|
||||
'formulario_id' => null,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
class EstadoProfesionalSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$estados = [
|
||||
['descripcion' => 'Activo'],
|
||||
['descripcion' => 'Baja'],
|
||||
];
|
||||
|
||||
foreach ($estados as $estado){
|
||||
DB::table('estadosprofesionales')->insert([
|
||||
'descripcion'=>$estado['descripcion'],
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class FaqAsistenteSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$items = [
|
||||
[
|
||||
'intencion' => 'ui_burbuja',
|
||||
'palabras_clave' => json_encode([]),
|
||||
'respuesta' => '¡Hola soy Clara!, ¿te puedo ayudar en algo?',
|
||||
'orden' => 1,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'ui_panel_inicio',
|
||||
'palabras_clave' => json_encode([]),
|
||||
'respuesta' => 'Hola, soy Clara, la asistente virtual de Abogadas del Litoral. Escribí una palabra clave con el tema con el que necesites ayuda.',
|
||||
'orden' => 2,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'ui_error',
|
||||
'palabras_clave' => json_encode([]),
|
||||
'respuesta' => 'Lo siento, no tengo una respuesta exacta para eso. Si tenes dudas, podes enviar un formulario para solicitar un turno con algún profesional o contactarnos por las redes',
|
||||
'orden' => 3,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'ui_nombre',
|
||||
'palabras_clave' => json_encode([]),
|
||||
'respuesta' => 'Clara',
|
||||
'orden' => 4,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'servicios',
|
||||
'palabras_clave' => json_encode(['servicio', 'servicios']),
|
||||
'respuesta' => 'Actualmente hay {cantidad_servicios} servicios activos en la web. En la sección Servicios podes ver el detalle de cada uno.',
|
||||
'orden' => 10,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'profesionales',
|
||||
'palabras_clave' => json_encode(['profesional', 'profesionales', 'abogada', 'abogadas', 'equipo']),
|
||||
'respuesta' => 'En este momento hay {cantidad_profesionales} profesionales activos. Los podes ver en la sección Equipo.',
|
||||
'orden' => 20,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'turnos',
|
||||
'palabras_clave' => json_encode(['turno', 'turnos', 'consulta', 'formulario', 'reserva']),
|
||||
'respuesta' => 'Para solicitar un turno, completá el formulario al final de esta página. Si ya tenes cuenta, también podés iniciar sesión para ver tus turnos. Recordá que solo podes iniciar sesión si sos cliente del estudio.',
|
||||
'orden' => 30,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'ubicacion',
|
||||
'palabras_clave' => json_encode(['ubicacion', 'ubicación', 'direccion', 'dirección', 'donde', 'dónde']),
|
||||
'respuesta' => 'La oficina está en Dr. Luis Pasteur 141, Paraná, Entre Ríos, Argentina.',
|
||||
'orden' => 40,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'horarios',
|
||||
'palabras_clave' => json_encode(['horario', 'horarios', 'dias', 'días', 'dia', 'día']),
|
||||
'respuesta' => 'Al cargar el formulario podés elegir días y horario de preferencia (AM, PM o indistinto).',
|
||||
'orden' => 50,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'contacto',
|
||||
'palabras_clave' => json_encode(['contacto', 'instagram', 'redes']),
|
||||
'respuesta' => 'Podés contactarte por Instagram desde el enlace en el pie de página o enviarnos el formulario de consulta.',
|
||||
'orden' => 60,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'login',
|
||||
'palabras_clave' => json_encode(['login', 'sesion', 'sesión', 'ingresar', 'iniciar sesion', 'registro', 'registrarse']),
|
||||
'respuesta' => 'Para ingresar, usá el botón Iniciar Sesión en la parte superior. Si sos cliente, entrás por login de cliente.',
|
||||
'orden' => 70,
|
||||
'activo' => true,
|
||||
],
|
||||
[
|
||||
'intencion' => 'honorarios',
|
||||
'palabras_clave' => json_encode(['honorarios', 'costo', 'precio', 'tarifa', 'honorario', 'costos', 'precios', 'tarifas']),
|
||||
'respuesta' => 'Los honorarios son los estipulados por el Colegio de abogados de la provincia de Entre Ríos, consultanos a través de nuestros medios de contacto el monto actualizado.',
|
||||
'orden' => 15,
|
||||
'activo' => true,
|
||||
],
|
||||
];
|
||||
|
||||
foreach ($items as $item) {
|
||||
DB::table('faq_asistentes')->updateOrInsert(
|
||||
['intencion' => $item['intencion']],
|
||||
[
|
||||
'palabras_clave' => $item['palabras_clave'],
|
||||
'respuesta' => $item['respuesta'],
|
||||
'orden' => $item['orden'],
|
||||
'activo' => $item['activo'],
|
||||
'updated_at' => now(),
|
||||
'created_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,18 +13,16 @@ class FotoSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$fotos = [
|
||||
['extension' => 'png', 'tamanio_bytes' => 136788, 'nombre' => 'default', 'mime_type' => 'image/png', 'ruta' => 'fotos/default.png'],
|
||||
];
|
||||
|
||||
DB::table('fotos')->insert([
|
||||
'extension' => $fotos[0]['extension'],
|
||||
'tamanio_bytes' => $fotos[0]['tamanio_bytes'],
|
||||
'nombre' => $fotos[0]['nombre'],
|
||||
'mime_type' => $fotos[0]['mime_type'],
|
||||
'ruta' => $fotos[0]['ruta'],
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
DB::table('fotos')->updateOrInsert(
|
||||
['ruta' => 'images/avatar_default.png'],
|
||||
[
|
||||
'extension' => 'png',
|
||||
'tamanio_bytes' => 136788,
|
||||
'nombre' => 'avatar_default',
|
||||
'mime_type' => 'image/png',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
class PersonaSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$personas = [[
|
||||
'dni' => '40563707',
|
||||
'nombre' => 'Camila Rosario',
|
||||
'apellido' => 'Belini',
|
||||
'cuil' => '27405637077',
|
||||
'fechanac' => '1997-08-21',
|
||||
'foto_id' => 1,
|
||||
],
|
||||
[
|
||||
'dni' => '43293244',
|
||||
'nombre' => 'Luciano Luca',
|
||||
'apellido' => 'Belini',
|
||||
'cuil' => '20432932444',
|
||||
'fechanac' => '2001-04-05',
|
||||
'foto_id' => 1,
|
||||
],
|
||||
[
|
||||
'dni' => '40987654',
|
||||
'nombre' => 'Cliente',
|
||||
'apellido' => 'Ficticio',
|
||||
'cuil' => '20409876544',
|
||||
'fechanac' => '2000-01-01',
|
||||
'foto_id' => 1,
|
||||
]];
|
||||
foreach($personas as $persona){
|
||||
DB::table('personas')->insert([
|
||||
'dni' => $persona['dni'],
|
||||
'nombre' => $persona['nombre'],
|
||||
'apellido' => $persona['apellido'],
|
||||
'cuil' => $persona['cuil'],
|
||||
'fechanac' => $persona['fechanac'],
|
||||
'foto_id' => $persona['foto_id'],
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,6 @@ class ProfesionSeeder extends Seeder
|
||||
{
|
||||
$profesiones = [
|
||||
['titulo' => 'Abogacía', 'visible_en_formulario' => true],
|
||||
['titulo' => 'Informático', 'visible_en_formulario' => false]
|
||||
];
|
||||
|
||||
foreach ($profesiones as $profesion){
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
class ProfesionalSeeder extends Seeder
|
||||
{
|
||||
/**
|
||||
* Run the database seeds.
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$profesional = [[
|
||||
'profesion_id' => 1,
|
||||
'matricula' => '5678',
|
||||
'correo' => 'CamyBelini@gmail.com',
|
||||
'dni' => '40563707',
|
||||
'persona_id' => 1,
|
||||
'estadoprofesional_id' => 1,
|
||||
'credencialprofesional_id' => 2,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
],
|
||||
[
|
||||
'profesion_id' => 2,
|
||||
'matricula' => '1234',
|
||||
'correo' => 'lucianobelini2015@gmail.com',
|
||||
'dni' => '43293244',
|
||||
'persona_id' => 2,
|
||||
'estadoprofesional_id' => 1,
|
||||
'credencialprofesional_id' => 3,
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]];
|
||||
|
||||
DB::table('profesionales')->insert($profesional);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
namespace Database\Seeders;
|
||||
|
||||
use Illuminate\Database\Console\Seeds\WithoutModelEvents;
|
||||
use Illuminate\Database\Seeder;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class ServicioSeeder extends Seeder
|
||||
{
|
||||
@@ -12,21 +12,55 @@ class ServicioSeeder extends Seeder
|
||||
*/
|
||||
public function run(): void
|
||||
{
|
||||
$contenidoWebId = (int) DB::table('contenidoswebs')->value('id');
|
||||
|
||||
DB::table('fotos')->updateOrInsert(
|
||||
['ruta' => 'images/Servicio.jpg'],
|
||||
[
|
||||
'extension' => 'jpg',
|
||||
'tamanio_bytes' => 0,
|
||||
'nombre' => 'Servicio',
|
||||
'mime_type' => 'image/jpeg',
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
|
||||
$fotoId = (int) DB::table('fotos')->where('ruta', 'images/Servicio.jpg')->value('id');
|
||||
$profesionAbogaciaId = (int) DB::table('profesiones')->where('titulo', 'Abogacía')->value('id');
|
||||
|
||||
if ($contenidoWebId <= 0 || $fotoId <= 0 || $profesionAbogaciaId <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
$servicios = [
|
||||
['titulo' => 'Consulta Jurídica', 'estado' => 'Activo', 'descripcion' => 'Consiste en una reunión con el profesional en la cual se podrá hacer una consulta sobre un tema particular'],
|
||||
['titulo' => 'Sucesión', 'estado' => 'Activo', 'descripcion' => 'El profesional asesorará al cliente en cuanto a sucesiones de bienes inmuebles de personas fallecidas'],
|
||||
['titulo' => 'Penal', 'estado' => 'Baja', 'descripcion' => 'El profesional asesorará al cliente acusado de cometer un delito de caracter penal. O en caso de que el cliente quiera acusar a otra persona por cometer un delito de caracter penal'],
|
||||
['titulo' => 'Servicio técnico/Informático', 'estado' => 'Alta', 'descripcion' => 'Servicio ofrecido por el personal de informática'],
|
||||
[
|
||||
'titulo' => 'Consulta jurídica',
|
||||
'estado' => 'activo',
|
||||
'descripcion' => 'Entrevista para evaluar el caso, orientar al cliente y definir los próximos pasos.',
|
||||
'visibleenweb' => 'si',
|
||||
'contenidoweb_id' => $contenidoWebId,
|
||||
'profesion_id' => $profesionAbogaciaId,
|
||||
'foto_id' => $fotoId,
|
||||
],
|
||||
];
|
||||
|
||||
foreach($servicios as $servicio)
|
||||
{
|
||||
DB::table('servicios')->insert([
|
||||
'titulo'=>$profesion['titulo'],
|
||||
'estado'=>$profesion['estado'],
|
||||
'descripcion'=>$profesion['descripcion'],
|
||||
]);
|
||||
};
|
||||
|
||||
foreach ($servicios as $servicio) {
|
||||
DB::table('servicios')->updateOrInsert(
|
||||
[
|
||||
'titulo' => $servicio['titulo'],
|
||||
'profesion_id' => $servicio['profesion_id'],
|
||||
],
|
||||
[
|
||||
'estado' => $servicio['estado'],
|
||||
'descripcion' => $servicio['descripcion'],
|
||||
'visibleenweb' => $servicio['visibleenweb'],
|
||||
'contenidoweb_id' => $servicio['contenidoweb_id'],
|
||||
'foto_id' => $servicio['foto_id'],
|
||||
'created_at' => now(),
|
||||
'updated_at' => now(),
|
||||
]
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user