php - Column not found updated_at and created_at with timestamps false Laravel 8

Maybe, I'm missing a little detail.
I'm trying to use create function inRegisterController
to insert data into 2 tables. Problem is that when I separate some of the data from$data
to insert into table personas from thePersona
model into$datos
and I usevar_dump()
to make sure I don't have thecreated_at
andupdated_at
values in$dato
when I try to insert with Create into personas it keeps trying to insert those values into personas table. I already have thepublic timestamps='false';
in my model.
Gonna post the code here
Create function code in RegisterController
protected function create(array $data)
{
$datos= ['nombre' => $data['name'],'apellido' => $data['surname'],'cedula' => $data['cedula'],'email' => $data['email'],
'telefono' =>$data['telefono'],'direccion' =>$data['direccion'],'ciudadResi' =>$data['ciudadResi'],'genero' =>$data['genero'],];
var_dump($datos);
Persona::create($datos)([
'nombre' => $datos['nombre'],
'apellido' => $datos['apellido'],
'cedula' => $datos['cedula'],
'email' => $datos['email'],
'telefono' =>$datos['telefono'],
'direccion' =>$datos['direccion'],
'ciudadResi' =>$datos['ciudadResi'],
'fechaNacimiento' =>'1998-03-05',
'genero' =>$datos['genero'],
'estado'=> '1',
'idTipoPersona'=>'2'
]);
User::create($data)([
'name' => 'clienteUser',
'surname' => $data['surname'],
'email' => $data['email'],
'nick' => $data['nick'],
'password' => Hash::make($data['password']),
'role' => 'cliente'
]);
}
Model persona code
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
class Persona extends Model
{
public $timestamps ='false';
protected $fillable = [
'nombre',
'apellido',
'cedula',
'email',
'telefono',
'direccion',
'ciudadResi',
'fechaNacimiento',
'genero'
];
protected $table ='personas';
use HasFactory;
The rest of the code of Persona are model relationships so that souldn't be relevant. How can I make the create of Persona stop trying to add the updated_at and created_at into the personas table?
English not my main language so sorry for any mistakes or if I'm not clear enough in one part of the problem, I would gladly edit the question as necessary.
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: warning: undefined array key
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.