creacion de las tablas narrativas y evidencias_narrativa

This commit is contained in:
Christian Dacid Sullca Puma 2022-10-10 15:31:12 -05:00
parent 302a39ec46
commit ef8dc455f7
4 changed files with 69 additions and 10 deletions

View File

@ -0,0 +1,22 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class EvidenciasNarrativas extends Model
{
use HasFactory;
protected $table = 'evidencias_narrativas';
protected $fillable = [
'codigo',
'denominacion',
'adjunto',
];
public function narrativas()
{
return $this->belongsTo(Narrativa::class, 'id_narrativa');
}
}

View File

@ -11,13 +11,13 @@ class Narrativa extends Model
protected $table = 'narrativas'; protected $table = 'narrativas';
protected $fillable = [ protected $fillable = [
'year',
'semestre', 'semestre',
'cabecera', 'cabecera',
'contenido', 'contenido',
]; ];
public function estandars(){ public function estandars()
{
return $this->belongsTo(Estandar::class, 'id_estandar'); return $this->belongsTo(Estandar::class, 'id_estandar');
} }
} }

View File

@ -16,8 +16,8 @@ public function up()
Schema::create('evidencias', function (Blueprint $table) { Schema::create('evidencias', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('codigo', 16); $table->string('codigo', 16);
$table->string('denominacion'); $table->string('denominacion', 255);
$table->string('adjunto'); $table->string('adjunto', 255);
$table->foreignId('id_user') $table->foreignId('id_user')
->constrained('users'); ->constrained('users');
$table->foreignId('id_plan') $table->foreignId('id_plan')

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.
*
* @return void
*/
public function up()
{
Schema::create('evidencias_narrativas', function (Blueprint $table) {
$table->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');
}
};