From ef8dc455f72aaf4e5e3455dd6a50fa1b2290ffa5 Mon Sep 17 00:00:00 2001 From: Christian Dacid Sullca Puma Date: Mon, 10 Oct 2022 15:31:12 -0500 Subject: [PATCH] creacion de las tablas narrativas y evidencias_narrativa --- app/Models/EvidenciasNarrativas.php | 22 +++++++++++ app/Models/Narrativa.php | 10 ++--- ...2_07_08_220043_create_evidencias_table.php | 10 ++--- ...351_create_evidencias_narrativas_table.php | 37 +++++++++++++++++++ 4 files changed, 69 insertions(+), 10 deletions(-) create mode 100644 app/Models/EvidenciasNarrativas.php create mode 100644 database/migrations/2022_10_10_144351_create_evidencias_narrativas_table.php diff --git a/app/Models/EvidenciasNarrativas.php b/app/Models/EvidenciasNarrativas.php new file mode 100644 index 0000000..a3b7232 --- /dev/null +++ b/app/Models/EvidenciasNarrativas.php @@ -0,0 +1,22 @@ +belongsTo(Narrativa::class, 'id_narrativa'); + } +} diff --git a/app/Models/Narrativa.php b/app/Models/Narrativa.php index 8d069cc..b082bc5 100644 --- a/app/Models/Narrativa.php +++ b/app/Models/Narrativa.php @@ -9,15 +9,15 @@ class Narrativa extends Model { use HasFactory; - protected $table ='narrativas'; + protected $table = 'narrativas'; protected $fillable = [ - 'year', 'semestre', 'cabecera', - 'contenido', + 'contenido', ]; - public function estandars(){ - return $this->belongsTo(Estandar::class,'id_estandar'); + public function estandars() + { + return $this->belongsTo(Estandar::class, 'id_estandar'); } } diff --git a/database/migrations/2022_07_08_220043_create_evidencias_table.php b/database/migrations/2022_07_08_220043_create_evidencias_table.php index 26eb2c1..f0a22f0 100644 --- a/database/migrations/2022_07_08_220043_create_evidencias_table.php +++ b/database/migrations/2022_07_08_220043_create_evidencias_table.php @@ -16,13 +16,13 @@ return new class extends Migration Schema::create('evidencias', function (Blueprint $table) { $table->id(); $table->string('codigo', 16); - $table->string('denominacion'); - $table->string('adjunto'); + $table->string('denominacion', 255); + $table->string('adjunto', 255); $table->foreignId('id_user') - ->constrained('users'); + ->constrained('users'); $table->foreignId('id_plan') - ->constrained('plans') - ->onDelete('cascade'); + ->constrained('plans') + ->onDelete('cascade'); $table->timestamps(); }); } diff --git a/database/migrations/2022_10_10_144351_create_evidencias_narrativas_table.php b/database/migrations/2022_10_10_144351_create_evidencias_narrativas_table.php new file mode 100644 index 0000000..746a412 --- /dev/null +++ b/database/migrations/2022_10_10_144351_create_evidencias_narrativas_table.php @@ -0,0 +1,37 @@ +id(); + $table->string('codigo', 16); + $table->string('denominacion', 255); + $table->string('adjunto', 255); + $table->foreignId('id_narrativa') + ->constrained('narrativas') + ->onDelete('cascade'); + $table->timestamps(); + }); + } + + /** + * Reverse the migrations. + * + * @return void + */ + public function down() + { + Schema::dropIfExists('evidencias_narrativas'); + } +};