Modificar (Estandar->Cabecera)

master
cgonzalesmo 2022-10-11 00:28:42 -05:00
parent 3079477eb0
commit a90ab4f0dc
3 changed files with 5 additions and 0 deletions

View File

@ -12,15 +12,18 @@ class EstandarController extends Controller
public function createEstandar(Request $request){ public function createEstandar(Request $request){
$request->validate([ $request->validate([
"name"=>"required", "name"=>"required",
"cabecera"=>"required",
]); ]);
$id_user = auth()->user()->id; $id_user = auth()->user()->id;
$estandar = new Estandar(); $estandar = new Estandar();
$estandar->id_user = $id_user; $estandar->id_user = $id_user;
$estandar->name = $request->name; $estandar->name = $request->name;
$estandar->cabecera = $request->cabecera;
$estandar->save(); $estandar->save();
return response([ return response([
"status" => 1, "status" => 1,
"msg" => "!Estandar creado exitosamente", "msg" => "!Estandar creado exitosamente",
"data" => $estandar,
]); ]);
} }

View File

@ -13,6 +13,7 @@ class Estandar extends Model
protected $table ='estandars'; protected $table ='estandars';
protected $fillable = [ protected $fillable = [
'name', 'name',
'cabecera'
]; ];

View File

@ -16,6 +16,7 @@ return new class extends Migration
Schema::create('estandars', function (Blueprint $table) { Schema::create('estandars', function (Blueprint $table) {
$table->id(); $table->id();
$table->string('name'); //cambiar el name por nombre $table->string('name'); //cambiar el name por nombre
$table->mediumText('cabecera');
$table->timestamps(); $table->timestamps();
//$table->foreign('id_user')->references('id')->on('users'); //$table->foreign('id_user')->references('id')->on('users');
$table->foreignId('id_user') $table->foreignId('id_user')