Commit c2997110 authored by Alfonso Rafael Solis Rangel's avatar Alfonso Rafael Solis Rangel
Browse files

Listas

parent 367c016c
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -12,7 +12,8 @@ class ListaController extends Controller
     */
    public function index()
    {
        //
        $listas = Lista::get();
        return view('adminGen.listas.index', compact('listas'));
    }

    /**
+1 −2
Original line number Diff line number Diff line
@@ -39,14 +39,13 @@ public function up(): void
            $table->unsignedBigInteger('cargo_id')->nullable();
            $table->unsignedBigInteger('caracteristica_id')->nullable();
            //$table->unsignedBigInteger('institucion_id')->nullable();
            $table->unsignedBigInteger('subgrupo_id')->nullable();
            
            $table->foreign('conyuge_id')->references('id')->on('contactos')->nullable();
            $table->foreign('profesion_id')->references('id')->on('profesions')->nullable();
            //$table->foreign('institucion_id')->references('id')->on('')->nullable();
            $table->foreign('cargo_id')->references('id')->on('cargos')->nullable();
            $table->foreign('caracteristica_id')->references('id')->on('caracteristicas')->nullable();
            $table->foreign('subgrupo_id')->references('id')->on('subgrupos')->nullable();
            
            $table->timestamps();
        });
    }
+32 −0
Original line number Diff line number Diff line
<?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('contactos_subgrupos', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('subgrupo_id');
            $table->unsignedBigInteger('contacto_id');
            $table->timestamps();

            $table->foreign('contacto_id')->references('id')->on('contactos')->onDelete('cascade')->onUpdate('cascade');
            $table->foreign('subgrupo_id')->references('id')->on('subgrupos')->onDelete('cascade')->onUpdate('cascade');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('contactos_subgrupos');
    }
};
+32 −0
Original line number Diff line number Diff line
<?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('contactos_grupos', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('grupo_id');
            $table->unsignedBigInteger('contacto_id');
            $table->timestamps();

            $table->foreign('contacto_id')->references('id')->on('contactos')->onDelete('cascade')->onUpdate('cascade');
            $table->foreign('grupo_id')->references('id')->on('grupos')->onDelete('cascade')->onUpdate('cascade');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('contactos_grupos');
    }
};
+46 −0
Original line number Diff line number Diff line
<?php

namespace Database\Seeders;

use Illuminate\Database\Console\Seeds\WithoutModelEvents;
use Illuminate\Database\Seeder;

use App\Models\Contacto;

use Faker\Factory as Faker;

class ContactoSeeder extends Seeder
{
    /**
     * Run the database seeds.
     */
    public function run(): void
    {
        $faker = Faker::create();

        for ($i = 0; $i < 1000; $i++) {
            Contacto::create([
                'nombre' => $faker->firstName,
                'ap_paterno' => $faker->lastName,
                'ap_materno' => $faker->lastName,
                'cargo_desc' => $faker->jobTitle,
                'mes_cump' => $faker->month,
                'dia_cump' => $faker->dayOfMonth,
                'domicilio_oficial' => $faker->address,
                'codigo_postal' => $faker->postcode,
                'localidad_oficial' => $faker->city,
                'municipio_oficial' => $faker->city,
                'estado' => $faker->state,
                'pais' => $faker->country,
                'domicilio_par' => $faker->address,
                'codigo_postal_par' => $faker->postcode,
                'localidad_par' => $faker->city,
                'municipio_par' => $faker->city,
                'estado_par' => $faker->state,
                'pais_par' => $faker->country,
                'finado' => $faker->boolean,
                'foto_perfil' => $faker->imageUrl(),
            ]);
        }
    }
}
Loading